This repository was archived by the owner on Jan 28, 2025. It is now read-only.
Next 12.2 middleware support - remove target config (#2477) - #2478
Open
revmischa wants to merge 4 commits into
Open
Next 12.2 middleware support - remove target config (#2477)#2478revmischa wants to merge 4 commits into
revmischa wants to merge 4 commits into
Conversation
Collaborator
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
}
}
} |
revmischa
commented
Aug 13, 2022
| 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"); |
revmischa
marked this pull request as ready for review
August 13, 2022 02:51
3 tasks
|
Hi, thanks for this initiative. Do you happen to have a merge preview? Currently I can't use Next12 middleware. |
Author
|
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 |
Author
|
Anyone who wants to deploy NextJS on AWS should look at https://github.com/jetbridge/cdk-nextjs or https://docs.sst.dev/constructs/NextjsSite |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
targetis 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
useServerlessTraceTargetoption or just assume it is true?Also the nextjs output directory now appears to be called
servernotserverless?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 becauseallowSyntheticDefaultImportsis 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)