-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
"Module not found" warnings when importing AWS s3 in app directory #51969
Comments
Hi, this is similar to #52091 (comment) The current solution is: /** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
serverComponentsExternalPackages: ['@aws-sdk/client-s3'],
},
}
module.exports = nextConfig |
That was it, thank you 🙏 For me specifically, I had to add two packages: /** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
serverComponentsExternalPackages: [
'@aws-sdk/client-s3',
'@aws-sdk/s3-presigned-post',
],
},
}
module.exports = nextConfig Just a note, and not meant as criticism but it might save you work in the future: I've read that documentation page in the past, but I honestly never connected it to this type of issue. Maybe it would be good to expand this page with:
Especially because for popular packages like Prisma this is done automatically, it can be extra confusing when it's not working. |
Thanks! We are discussing this internally to improve both the messaging, and hopefully also the automatic detection. |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 22.5.0: Thu Jun 8 22:21:34 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T8112 Binaries: Node: 16.18.1 npm: 8.19.2 Yarn: N/A pnpm: 8.6.3 Relevant Packages: next: 13.4.8-canary.8 eslint-config-next: 13.4.7 react: 18.2.0 react-dom: 18.2.0 typescript: 5.1.6 Next.js Config: output: N/A
Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true), Package manager (npm, pnpm, Yarn)
Link to the code that reproduces this issue or a replay of the bug
https://github.com/rijk/repro-s3-import-issue
To Reproduce
Module not found
warnings in the consoleDescribe the Bug
When importing from the s3 SDK in the app directory (either in a route handler or server action), this triggers a bunch of warnings (see below). This doesn't happen in the pages directory. Is module resolution different between the two?
Warnings:
Expected Behavior
The code should run without warnings, as it does in the pages directory.
Which browser are you using? (if relevant)
not relevant
How are you deploying your application? (if relevant)
not relevant
The text was updated successfully, but these errors were encountered: