-
-
Notifications
You must be signed in to change notification settings - Fork 457
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
Next 12.2 middleware support - remove target config (#2477) #2478
base: master
Are you sure you want to change the base?
Conversation
Handler Size Report
Base Handler Sizes (kB) (commit e6367b5){
"Lambda": {
"Default Lambda": {
"Standard": 1578,
"Minified": 692
},
"Image Lambda": {
"Standard": 1543,
"Minified": 831
}
},
"Lambda@Edge": {
"Default Lambda": {
"Standard": 1588,
"Minified": 698
},
"Default Lambda V2": {
"Standard": 1580,
"Minified": 694
},
"API Lambda": {
"Standard": 634,
"Minified": 318
},
"Image Lambda": {
"Standard": 1551,
"Minified": 835
},
"Regeneration Lambda": {
"Standard": 1233,
"Minified": 566
},
"Regeneration Lambda V2": {
"Standard": 1307,
"Minified": 596
}
}
} New Handler Sizes (kB) (commit a24740c){
"Lambda": {
"Default Lambda": {
"Standard": 1849,
"Minified": 802
},
"Image Lambda": {
"Standard": 1814,
"Minified": 956
}
},
"Lambda@Edge": {
"Default Lambda": {
"Standard": 1860,
"Minified": 808
},
"Default Lambda V2": {
"Standard": 1851,
"Minified": 804
},
"API Lambda": {
"Standard": 634,
"Minified": 318
},
"Image Lambda": {
"Standard": 1821,
"Minified": 961
},
"Regeneration Lambda": {
"Standard": 1505,
"Minified": 676
},
"Regeneration Lambda V2": {
"Standard": 1578,
"Minified": 706
}
}
} |
@@ -91,7 +90,7 @@ class Builder { | |||
this.nextConfigDir = path.resolve(nextConfigDir); | |||
this.nextStaticDir = path.resolve(nextStaticDir ?? nextConfigDir); | |||
this.dotNextDir = path.join(this.nextConfigDir, ".next"); | |||
this.serverlessDir = path.join(this.dotNextDir, "serverless"); | |||
this.serverlessDir = path.join(this.dotNextDir, "server"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this changed
Hi, thanks for this initiative. Do you happen to have a merge preview? Currently I can't use Next12 middleware. |
I don't know if these changes are worth pursuing for this module. I want to investigate the much simplified approach using the new I would also advise checking out https://github.com/sladg/nextjs-lambda |
Anyone who wants to deploy NextJS on AWS should look at https://github.com/jetbridge/cdk-nextjs or https://docs.sst.dev/constructs/NextjsSite |
target
is no longer a supported configuration option in nextjs.If you try to use a recent version of Nextjs with middleware this becomes a build error: #2477
Perhaps we should remove the
useServerlessTraceTarget
option or just assume it is true?Also the nextjs output directory now appears to be called
server
notserverless
?Also we need to support the next ESM config format for nextjs - next.config.mjs
If we try to require() the ESM config it errors with:
I tried changing the require to dynamic import but TS appears to rewrite it as a
require()
anyway, I assume becauseallowSyntheticDefaultImports
is set in the tsconfig. If I disable it then it throws the errorSo we can't support importing mjs config files right now I guess 🤷🏻
Results
These changes at least let me build my app. But I get an error:
From default-handler
Trying to figure out why
This is the key requested:
This is the bucket:
Interestingly the BUILD_ID file that gets uploaded to the S3 bucket has the new, correct build ID but the static-pages dir doesn't contain the new build folder (it exists on the filesystem though in
.next/static
)