This repository was archived by the owner on Jan 28, 2025. It is now read-only.
Resolve dependencies using .next/serverless as base path #425
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.
Problem
When using the new
experimental-serverless-trace
build target, the Next.js Serverless Component is copying Lambda dependencies to wrong destinations in two identified scenarios (see issue #236):"<root>/.next/serverless"
, when they should be placed directly into"<root>"
.node_modules
should always be copied to<root>
PS.:
<root>
is"<next config path>/.serverless_nextjs/<lambda handler>"
Solution
The component now uses
<next config path>/.next/serverless
as the relative base path to calculate Lambda handler dependencies destinations. Also, allnode_modules
files are now copied to<root>/node_modules
, ignoring relative parent paths. These changes should resolve the issues in both scenarios.