Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 BUG: Error on building a remix app with @aws-sdk/credential-providers #7033

Open
ikazoy opened this issue Oct 21, 2024 · 0 comments
Open
Labels
bug Something that isn't working

Comments

@ikazoy
Copy link

ikazoy commented Oct 21, 2024

Which Cloudflare product(s) does this pertain to?

Pages, Wrangler

What version(s) of the tool(s) are you using?

3.57.1 [Wrangler]

What version of Node are you using?

No response

What operating system and version are you using?

Mac Sonoma 14.6.1

Describe the Bug

Observed behavior

Cannot deploy my remix app with "@aws-sdk/credential-providers" to Cloudflare pages environment.

Error:

npm run deploy

✘ [ERROR] 1 error(s) and 0 warning(s) when compiling Worker.



✘ [ERROR] No matching export in "../node_modules/@aws-sdk/credential-providers/dist-es/index.browser.js" for import "fromIni"

    ../build/server/index.js:6:9:
      6 │ import { fromIni } from "@aws-sdk/credential-providers";
        ╵          ~~~~~~~


✘ [ERROR] Build failed with 1 error:

  ../build/server/index.js:6:9: ERROR: No matching export in
  "../node_modules/@aws-sdk/credential-providers/dist-es/index.browser.js" for import "fromIni"

I have confirmed that dist-es/index.js does have export * from "./fromIni"; while dist-es/index.browser.js not.
If my understanding is correct, index.js is supposed to be used because the code is for loader function which is on server-side, instead of index.browser.js.

Expected behavior

Successful deployment without error.

Steps to reproduce

Here is a minimal codebase to reproduce the bug.

  • npm install
  • npm run deploy
  1. Create a remix project with npm create cloudflare@latest -- my-remix-app --framework=remix by following this page
  2. Confirm the initial setup is working and can be deployed without error to Cloudflare page
  3. Add import { fromIni } from "@aws-sdk/credential-providers and call it from the loader function
  4. npm run deploy shows the error

This is the code which cause the error.

import { fromIni } from "@aws-sdk/credential-providers"

export const loader: LoaderFunction = async () => {
  new QuickSightClient({
    region: "us-east-1",
    credentials: fromIni({
      profile: "default",
    }),
  })
}

Please provide a link to a minimal reproduction

https://github.com/ikazoy/cloudflare-remix-reproduction

Please provide any relevant error logs

$ npm run deploy

deploy
npm run build && wrangler pages deploy

build
remix vite:build

vite v5.4.9 building for production...
✓ 87 modules transformed.
build/client/.vite/manifest.json 1.49 kB │ gzip: 0.36 kB
build/client/assets/root-DTvCnnOP.css 6.76 kB │ gzip: 2.01 kB
build/client/assets/analytics.dashboard._dashboardId-CiI7Hsud.js 0.10 kB │ gzip: 0.12 kB
build/client/assets/root-Bv85obuH.js 1.73 kB │ gzip: 0.98 kB
build/client/assets/entry.client-K1NPw7Hx.js 3.74 kB │ gzip: 1.42 kB
build/client/assets/_index-DnPs6FvX.js 5.05 kB │ gzip: 2.06 kB
build/client/assets/jsx-runtime-56DGgGmo.js 8.11 kB │ gzip: 3.06 kB
build/client/assets/components-DCLLcppY.js 245.72 kB │ gzip: 79.30 kB
✓ built in 7.18s
vite v5.4.9 building SSR bundle for production...
✓ 7 modules transformed.
build/server/.vite/manifest.json 0.22 kB
build/server/assets/server-build-DTvCnnOP.css 6.76 kB
build/server/index.js 12.29 kB
✓ built in 470ms
▲ [WARNING] Warning: Your working directory is a git repo and has uncommitted changes

To silence this warning, pass in --commit-dirty=true

✘ [ERROR] 1 error(s) and 0 warning(s) when compiling Worker.

✘ [ERROR] No matching export in "../node_modules/@aws-sdk/credential-providers/dist-es/index.browser.js" for import "fromIni"

../build/server/index.js:6:9:
  6 │ import { fromIni } from "@aws-sdk/credential-providers";
    ╵          ~~~~~~~

✘ [ERROR] Build failed with 1 error:

../build/server/index.js:6:9: ERROR: No matching export in
"../node_modules/@aws-sdk/credential-providers/dist-es/index.browser.js" for import "fromIni"

🪵 Logs were written to "/Users/ikazoy/.wrangler/logs/wrangler-2024-10-21_06-42-22_059.log"

@ikazoy ikazoy added the bug Something that isn't working label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working
Projects
Status: Untriaged
Development

No branches or pull requests

1 participant