@aws-sdk/s3-request-presigner
semver
>=3.0.0 <4.0.0postconditions9functions3last verified2026-06-24coverage score100%Postconditions: what we check
- getSignedUrl · presigner-credential-errorerrorWhenCredential resolution fails: no credentials configured, IAM role unavailable, credentials expired, invalid access key ID, or wrong secret keyThrows
CredentialsProviderError when credentials cannot be resolved (no env vars, no IAM role, no credential file). CredentialsError or generic Error on expired/invalid credentials. All errors reject the returned Promise.Required handlingCaller MUST wrap getSignedUrl() in try-catch. Credential failures are common in serverless environments where IAM roles may not be configured, env vars may be missing (VERCEL deployment, CI), or tokens may expire. Minimum handling: try { const url = await getSignedUrl(s3Client, command, { expiresIn: 3600 }); return url; } catch (err) { console.error('Failed to generate presigned URL:', err); throw err; }costmediumin prodimmediate exceptionusers seeservice unavailablevisibilityvisible - getSignedUrl · presigner-expires-in-too-largeerrorWhenoptions.expiresIn is set to a value greater than 604800 (7 days in seconds). This is a common mistake when developers confuse milliseconds with seconds, pass Date.now() directly, or attempt to create "permanent" links.Throws
Promise.reject() with the string message: "Signature version 4 presigned URLs must have an expiration date less than one week in the future". This is a string rejection (not an Error instance) from @smithy/signature-v4.Required handlingCaller MUST wrap getSignedUrl() in try-catch and validate expiresIn is <= 604800. Note: if using temporary credentials (IAM role, STS), the URL will expire earlier than expiresIn — at the point the underlying STS token expires. Safe maximum: const url = await getSignedUrl(s3Client, command, { expiresIn: 3600, // 1 hour — well within the 7-day maximum });costlowin prodimmediate exceptionusers seedegraded performancevisibilitysilent - getSignedUrl · presigner-not-valid-http-requesterrorWhenThe resolved request object passed through the client middleware stack is not an HttpRequest instance. This happens when a custom Command implementation builds a non-HTTP payload, when serializers are mis-wired, or when getSignedUrl is called against a non-S3-shaped client whose internal request is something other than HttpRequest. Rare but production-visible when teams roll custom commands for special-case S3 access patterns.Throws
Error("Request to be presigned is not an valid HTTP request.") — thrown synchronously inside the async middleware, surfaces as a rejected Promise to the getSignedUrl caller.Required handlingWrap getSignedUrl() in try-catch. Distinguish this error from credential errors by message content if you need to alert differently (this signals a wiring/serializer bug, not a runtime credential failure).costlowin prodimmediate exceptionusers seeservice unavailablevisibilityvisibleSources[5] - getSignedUrl · presigner-invalid-credential-objecterrorWhenThe AWS credentials object returned by the credential provider is malformed: missing accessKeyId, missing secretAccessKey, or either field is not a string. Common when a custom credential provider returns a partial object, or when environment variables are set to empty strings rather than being absent.Throws
Error("Resolved credential object is not valid") from @smithy/signature-v4. This is distinct from CredentialsProviderError — the provider resolved successfully but returned an unusable object.Required handlingCaller MUST wrap getSignedUrl() in try-catch. Validate that AWS credentials have both accessKeyId and secretAccessKey before calling. Check for empty string values in addition to undefined.costlowin prodimmediate exceptionusers seeservice unavailablevisibilityvisibleSources[6] - S3RequestPresigner.presign · presigner-class-presign-expires-errorerrorWhenoptions.expiresIn exceeds 604800 seconds (7 days). Same limit as getSignedUrl. Since the default is 900s, this only triggers with explicit large values.Throws
Promise.reject() with string "Signature version 4 presigned URLs must have an expiration date less than one week in the future". String rejection, not Error instance.Required handlingWrap in try-catch. Ensure expiresIn <= 604800 when passed explicitly.costlowin prodimmediate exceptionusers seedegraded performancevisibilitysilentSources[4] - S3RequestPresigner.presign · presigner-class-presign-sigv4a-missing-crterrorWhenThe S3 bucket uses S3 Multi-Region Access Points (MRAPs) requiring SigV4a signing (signingRegion = '*'). The @aws-sdk/signature-v4-crt or @aws-sdk/signature-v4a package is not installed/registered. This occurs when using MRAPs in serverless environments where native addons are unavailable.Throws
Error: "presign with signingRegion '*' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. Please check whether you have installed the '@aws-sdk/signature-v4-crt' package explicitly."Required handlingWrap in try-catch. If using S3 Multi-Region Access Points, install and register @aws-sdk/signature-v4-crt (native module, Node.js only) or @aws-sdk/signature-v4a (pure JS). Cannot be used in browser or edge runtimes without the JS implementation.costmediumin prodimmediate exceptionusers seeservice unavailablevisibilityvisible - S3RequestPresigner.presign · presigner-class-presign-invalid-credentialserrorWhenThe credential object passed to the signer is malformed (missing accessKeyId or secretAccessKey). Same as presigner-invalid-credential-object for getSignedUrl.Throws
Error("Resolved credential object is not valid")Required handlingWrap in try-catch. Validate credentials object before constructing S3RequestPresigner.costlowin prodimmediate exceptionusers seeservice unavailablevisibilityvisibleSources[6] - S3RequestPresigner.presignWithCredentials · presigner-presign-with-credentials-mrap-unsupportederrorWhenoptions.signingRegion is '*' (required for S3 Multi-Region Access Points). presignWithCredentials explicitly does not support MRAP / SigV4a signing. This is a hard limitation distinct from the CRT availability check — even with CRT installed, this method throws.Throws
Error("Method presignWithCredentials is not supported for [signingRegion=*].") Thrown synchronously within the returned Promise.Required handlingWrap in try-catch. For MRAP buckets, use S3RequestPresigner.presign() instead, which does support SigV4a via CRT. Do not use presignWithCredentials with MRAPs.costmediumin prodimmediate exceptionusers seeservice unavailablevisibilityvisible - S3RequestPresigner.presignWithCredentials · presigner-presign-with-credentials-expires-errorerrorWhenoptions.expiresIn exceeds 604800 seconds (7 days). Same MAX_PRESIGNED_TTL limit applies to all presigning paths including presignWithCredentials.Throws
Promise.reject() with string "Signature version 4 presigned URLs must have an expiration date less than one week in the future".Required handlingWrap in try-catch. Validate expiresIn <= 604800.costlowin prodimmediate exceptionusers seedegraded performancevisibilitysilentSources[4]
Sources
Every postcondition cites at least one of these. Grouped by source type; numbered to match the footnotes above.
Official documentation
- [1]docs.aws.amazon.com/AWSJavaScriptSDK/v3/latestAws Sdk S3 Request Presigner
- [2]docs.aws.amazon.com/AWSJavaScriptSDK/v3/latestS3
- [3]docs.aws.amazon.com/AmazonS3/latest/userguideUsing Presigned Url
- [8]docs.aws.amazon.com/AmazonS3/latest/userguideMultiRegionAccessPoints
Source code
- [4]github.com/smithy-lang/smithy-typescript/blobsmithy-lang/smithy-typescript · SignatureV4.ts
- [5]github.com/aws/aws-sdk-js-v3/blobaws/aws-sdk-js-v3 · getSignedUrl.ts
- [6]github.com/smithy-lang/smithy-typescript/blobsmithy-lang/smithy-typescript · SignatureV4Base.ts
- [7]github.com/aws/aws-sdk-js-v3/treeaws/aws-sdk-js-v3 · signature-v4-multi-region
Research notes
Curator notes from SOURCES.md captured when the profile was written so you can verify the reasoning, not just the rules.
Sources — @aws-sdk/s3-request-presigner
Official Documentation
- Package Reference: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-s3-request-presigner/
- S3 Client Reference (errors): https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/s3/
- AWS Blog — Generate Presigned URL: https://aws.amazon.com/blogs/developer/generate-presigned-url-modular-aws-sdk-javascript/
- S3 Error Responses: https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html
Behavioral Claims
getSignedUrl throws on credential failure
Source: AWS SDK v3 credential provider chain documentation.
Both getSignedUrl and createPresignedPost call the credential provider chain internally
before signing. If no credentials are found, a CredentialsProviderError is thrown.
Common real-world failure scenarios:
- Vercel deployment missing
AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEYenv vars - Local dev without
~/.aws/credentialsconfigured - STS temporary credentials expired mid-session
- IAM role not attached in non-AWS serverless environments
createPresignedPost has identical error surface
Same credential resolution path as getSignedUrl. Both functions use the S3 presigner
utility from @smithy/signature-v4 under the hood.
npm Package
- https://www.npmjs.com/package/@aws-sdk/s3-request-presigner
- Weekly downloads: ~4M (as of 2026-Q1)
- Part of the
@aws-sdkmonorepo: https://github.com/aws/aws-sdk-js-v3
Evidence Quality: partial
The partial rating reflects that:
- The error surface is real and documented in SDK source code
- Official AWS documentation examples often omit try-catch (reducing citable examples)
- Behavioral claims are confirmed by common production failure patterns
- No official AWS error handling guide specifically addresses presigner failures
Need a different package?
Request a profile