Unable to use @aws-sdk/client-s3 in Nuxt 3 Pages
I have a new Nuxt 3.6.1 application deployed with cloudflare-pages and everything works as expected.
When using @aws-sdk/client-s3 and creating a new s3client the deployment to cloudflare-pages fails after the build and upload is already completed:
✨ Upload complete!
Success: Assets published!
Error: Failed to publish your Function. Got error: Uncaught TypeError: Cannot convert object to primitive value
at functionsWorker-0.18438961492783257.js:20415:77 in e2.defaultUserAgent
at functionsWorker-0.18438961492783257.js:22815:340 in Ry.getRuntimeConfig
at functionsWorker-0.18438961492783257.js:22820:44 in S3Client
at functionsWorker-0.18438961492783257.js:30336:1
Building the application on my local machine works. I also made sure to use the same nitro preset and node version 18.17.08 Replies
any updates? i'm having a similar error, trying to find a way to somehow debug this
Does anyone have a minimal repro for this? This is likely caused by something being turned into a
Proxy
in a dependency. I'm happy to poke more if someone can provide a basic repro repo.Thanks @cherryjimbo for the support.
In my case it is a freshly created Nuxt 3.6.5 project with an api route initalizing a new S3Client:
I can get my deployment working when I move the initializing of the s3Client into the "defineEventHandler" . But then I am getting the "Cannot convert object to primitive value" error when calling the api route.
@cherryjimbo aditionaly I created this Nuxt 3 starter repository which produces the same error: https://github.com/FISCHKE/cloudflare-pages
GitHub
GitHub - FISCHKE/cloudflare-pages
Contribute to FISCHKE/cloudflare-pages development by creating an account on GitHub.
Are the provided exmaples enough to reproduce the problem or do you need additional information @cherryjimbo ?
If it helps here is the deployment id: adb468ae-806a-484b-8089-866c5e63bd13
I'm afraid I've not had a chance to look at this yet, sorry
Any update on this? I'm facing the exact same error when trying to deploy an app that uses
@aws-sdk/client-s3
to connect to R2 on Pages@James I'm also having this issue, but not when building, I actually see this in the log streaming. I've added more details on this issue: https://github.com/unjs/nitro/issues/1882#issuecomment-2053895539
GitHub
Preset cloudflare-pages/cloudflare-module not working with @aws-sdk...
Environment Nuxt 3.8.0 with Nitro 2.7.2 vite v4.5.0 Reproduction https://codesandbox.io/p/github/unjs/nitro/csb-z43zd7/draft/tender-wu Run "Nitro Build" Task from the "Run Task or Te...