-
Notifications
You must be signed in to change notification settings - Fork 579
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
Nextjs build error for aws sdk client s3 / request presigner... on versions higher than 3.623.0 #6411
Comments
Hi @luong-komorebi - thanks for reporting. While we further look into it, can you share your SDK minimal repro code with Next.js? Here's my quick repro attempt with npx create-next-app next-aws-sdk-repro
cd next-aws-sdk-repro
npm install @aws-sdk/[email protected] @aws-sdk/[email protected] SDK import { S3Client, GetObjectCommand } from "@aws-sdk/client-s3";
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
const s3Client = new S3Client({
region: "us-west-1",
credentials: {
accessKeyId: "ACCESS_KEY_ID",
secretAccessKey: "SECRET_ACCESS_KEY",
},
});
export default async function handler(req, res) {
try {
const command = new GetObjectCommand({
Bucket: "BUCKET_NAME",
Key: "OBJECT_KEY",
});
const signedUrl = await getSignedUrl(s3Client, command, {
expiresIn: 3600,
});
res.status(200).json({ signedUrl });
} catch (error) {
console.error(error);
res.status(500).json({ error: error.message });
}
} Best, |
@aBurmeseDev sorry I could not share the original source code and I could not also reproduce this in a fresh nextjs project with some similar next.config.js setting so I am not sure what was causing the error Please feel free to close this issue. serverComponentsExternalPackages: [
"@aws-sdk/client-s3",
"@aws-sdk/s3-request-presigner"
] like some suggestions on the internet and it works. |
I'm experiencing the same issue right now. Same problem on .629 and latest .637 |
Same issue for me, reverting to 3.623.0 worked as a temporary fix. |
Add this to your nextjs config:
Notice that
Links to the docs: |
@magoz I already have that in my config, and it did not fix anything. Reverting to .623 worked. |
@kasperaamodt, double-check that you add the In any case, I agree that this must be fixed. |
@magoz Ahh, sorry i did not catch that! My bad. That fixed it. |
Ideally, we should not have to config the |
same here with '@aws-sdk/middleware-sdk-s3', '@aws-sdk/client-s3', '@aws-sdk/s3-request-presigner' packages |
Checkboxes for prior research
Describe the bug
When building nextjs with
or any higher versions than 3.623.0
we were reported these errors
while the same log has been reported a few times on the internet with some possible resolution, like this one from stackoverflow or inside this issue on Github , I find it strange that I never had to apply any of these configs or hacks or fixes prior to version 3.623.0 to make
next build
workI am not too familiar with
@smithy/util-retry
as well as the changes in changelog is not super relevant to this error, so I dont know what is going on. But by bruteforcing versions, I find that it starts happening at 3.624.0 and the last version I was to install without errors is 3.623.0Please help me understand why this error is happening. The latest version (3.637.0) has not fixed this yet
SDK version number
@aws-sdk/[email protected], @aws-sdk/[email protected]
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v20.13.1
Reproduction Steps
Install @aws-sdk/client-s3@^3.624.0 in any nextjs project and start
next build
itObserved Behavior
Expected Behavior
No errors on building
Possible Solution
Revert to 3.623.0
Additional Information/Context
smithy-codegen
The text was updated successfully, but these errors were encountered: