nitrojs / nitrojs/nitro

Preset cloudflare-pages/cloudflare-module not working with @aws-sdk

Open
#1,882 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug nuxt unenv v2
Dominant language
TypeScript
Stars
11.2k
Forks
899
Avg merge
2d 24m
Merged PRs (30d)
40

Description

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

  1. Run "Nitro Build" Task from the "Run Task or Terminal" button
  2. Run "Wrangler" Task
    3.-> observe following error when the code is trying to load the @aws-sdk
[nitro] [request error] [unhandled] Cannot convert object to primitive value
  at e2.defaultUserAgent (file:.//project/nitro/.wrangler/tmp/dev-mFkcA3/dmwkb6o22td.js:13983:77)  
  at Um.getRuntimeConfig (file:.//project/nitro/.wrangler/tmp/dev-mFkcA3/dmwkb6o22td.js:15730:388)  
  at new PollyClient (file:.//project/nitro/.wrangler/tmp/dev-mFkcA3/dmwkb6o22td.js:15755:44)  
  at file:.//project/nitro/.wrangler/tmp/dev-mFkcA3/dmwkb6o22td.js:16681:14  
  at file:.//project/nitro/.wrangler/tmp/dev-mFkcA3/dmwkb6o22td.js:2318:26  
  at Object.handler (file:.//project/nitro/.wrangler/tmp/dev-mFkcA3/dmwkb6o22td.js:3428:54)  
  at Object.handler (file:.//project/nitro/.wrangler/tmp/dev-mFkcA3/dmwkb6o22td.js:2343:29)  
  at async file:.//project/nitro/.wrangler/tmp/dev-mFkcA3/dmwkb6o22td.js:2420:7  
  at async file:.//project/nitro/.wrangler/tmp/dev-mFkcA3/dmwkb6o22td.js:3451:20  
  at async jsonError (file:.//project/nitro/.wrangler/tmp/dev-mFkcA3/dmwkb6o22td.js:16695:12)
Describe the bug

Can not use AWS-SDK with cloudflare-pages/cloudflare-module Nitro Preset and using wrangler to deploy to Cloudflare, always getting errors from AWS-SDK.

I found a somewhat related issue but don't understand how to workaround: https://github.com/cloudflare/workers-sdk/issues/2081

Additional context

No response

Logs

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CodeSandbox reproduction, run the Nitro Build and Wrangler tasks, and inspect the @aws-sdk failure at the shown defaultUserAgent and PollyClient stack frames. Done means the AWS SDK loads successfully when using the cloudflare-pages/cloudflare-module preset and the Wrangler deployment no longer reports the conversion error.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, nuxt, typescript
Domain
backend, cloud, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.