S3 signed urls
I have an existing react app + AWS services.
We have recently added a chat area in our app using Convex.
We have a users database in AWS rds mysql which is synced with the users table in Convex.
The problem we're facing now is how to generate signed urls when displaying the chat messages on the ui with its user avatar.
One way we tried without any success is creating another .ts file under convex/functions which is marked as "use node" and use the "@aws-sdk/cloudfront-signer" to do the job.
However, this can be only an action which we are not able to use inside a convex query which is where we fetch the users with the messages.
Has someone faced similar issue? Is there a better strategy to approach this problem?
Thanks
1 Reply
In the R2 component we use S3 api's, and
getSignedUrl
from @aws-sdk/s3-request-presigner
works in the Convex runtime, and without making external requests - should work in a query. Example: https://github.com/get-convex/r2/blob/594a9b47ae9440fe71dc32d30b3ce70c15ea2b20/src/client/index.ts#L153-L157
Assuming that's compatible with your needs that is, don't know if there's something cloudfront specific required that this library doesn't handle