Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
193 changes: 177 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions packages/apify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@
"@apify/input_secrets": "^1.1.40",
"@apify/log": "^2.4.3",
"@apify/timeout": "^0.3.0",
"@apify/utilities": "^2.9.3",
"@crawlee/core": "^3.9.0",
"@crawlee/types": "^3.9.0",
"@crawlee/utils": "^3.9.0",
"@apify/utilities": "^2.13.0",
"@crawlee/core": "^3.12.3-beta.12",
"@crawlee/types": "^3.12.3-beta.12",
"@crawlee/utils": "^3.12.3-beta.12",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and don't forget to bump this

"apify-client": "^2.11.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the downgrade here? 👀

"fs-extra": "^11.2.0",
"ow": "^0.28.2",
"semver": "^7.5.4",
"tslib": "^2.6.2",
"ws": "^8.18.0"
}
}
}
7 changes: 6 additions & 1 deletion packages/apify/src/key_value_store.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { createHmacSignature } from '@apify/utilities';
import type { StorageManagerOptions } from '@crawlee/core';
import { KeyValueStore as CoreKeyValueStore } from '@crawlee/core';

Expand All @@ -19,7 +20,11 @@ export class KeyValueStore extends CoreKeyValueStore {
return getPublicUrl.call(this, key);
}

return `https://api.apify.com/v2/key-value-stores/${this.id}/records/${key}`;
if (!this.storageObject?.urlSigningSecretKea) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

urlSigningSecretKea instead of ...key might be a typo?

return `https://api.apify.com/v2/key-value-stores/${this.id}/records/${key}`;
}

return `https://api.apify.com/v2/key-value-stores/${this.id}/records/${key}?signature=${createHmacSignature(this.storageObject.urlSigningSecretKea as string, key)}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we pls compose the URL with URL.searchParams and similar? Maybe concatting the path with path.posix.join() too?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from ensuring the correct URL syntax, this procedural approach might also allow us to only specify the pathname once (and just conditionally add the query parameter if the secret exists).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, makes sense. Refactored it 🙃

}

/**
Expand Down
Loading