Unable to use aws-sdk in production
Hi there!
I have a SvelteKit endpoint supposed to be a Worker that use the aws-sdk, everything work well in my other endpoints so Worker adapter and so are configured well.
Everything work well in my local dev env too
But in the deployed version on Cloudflare Pages I got an 500 internal error message
When I remove the import of the aws-sdk, it works, so I assume this is the cause of the error?
here's the line that cause the error: import S3 from 'aws-sdk/clients/s3.js';
If this line is on my endpoint, result in "internal error" message.
Maybe you have an hint? 🙂
2 Replies
SOLVED: 'aws-sdk' is not available in Workers, use 'aws4fetch' instead 🙂
is this still the case? having a similar issue but the only command failing is
AdminAddUserToGroup
using the Cognito provider from the SDK. Should I pivot to using aws4fetch
SOLVED: this was concerning sync & async programming. Moving the part of my flow using the above API method to use synchronous logic fixed my issues when deployed. Strange there was no similar errors locally but understandable in retrospect.