presignUrl()
Takes a private S3 object and turns it into a public URL by signing with your AWS credentials.
Example
import {presignUrl } from '@remotion/lambda/client';
const url = await presignUrl ({
region : 'us-east-1',
bucketName : 'remotionlambda-c7fsl3d',
objectKey : 'assets/sample.png',
expiresInSeconds : 900,
checkIfObjectExists : true,
});
console .log (url ); // `string` - or `null` if object doesn't exist
const url2 = await presignUrl ({
region : 'us-east-1',
bucketName : 'remotionlambda-c7fsl3d',
objectKey : 'assets/sample.png',
expiresInSeconds : 900,
checkIfObjectExists : false,
});
console .log (url2 ); // always a string, even if the object doesn't existPreferrably import this function from @remotion/lambda/client (available from v3.3.42) to avoid problems inside serverless functions.
Arguments
An object with the following properties:
region
The AWS region in which the bucket resides.
bucketName
The bucket where the asset exists. The bucket must have been created by Remotion Lambda.
objectKey
They key that uniquely identifies the object stored in the bucket.
expiresInSeconds
The number of seconds before the presigned URL expires.
Must be an integer and >=1 and <=604800 (maximum of 7 days as enforced by AWS)
checkIfObjectExists
Whether the function should check if the object exists in the bucket before generating the presigned url. Default false.
If checkIfObjectExists is true and the object does not exist, null is returned.
If checkIfObjectExists is false, no check is made and a URL is always returned, even if the object does not exist.
forcePathStyle?v4.0.202
Passes forcePathStyle to the AWS S3 client.
requestHandler?v4.0.315
A custom AWS SDK request handler, for example to use a proxy.
Compatibility
| Servers | Environments | |||||
|---|---|---|---|---|---|---|
Node.js | Bun | Serverless Functions | ||||
Node.js runtime | ||||||
For serverless functions, use the light client.