workers-sdk
workers-sdk copied to clipboard
๐ BUG: Error on building a remix app with @aws-sdk/credential-providers
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
- Create a remix project with
npm create cloudflare@latest -- my-remix-app --framework=remixby following this page - Confirm the initial setup is working and can be deployed without error to Cloudflare page
- Add
import { fromIni } from "@aws-sdk/credential-providersand call it from the loader function npm run deployshows 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"