Skip to content
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

Increase memory for server function on Next.js with image optimization #7940

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

chalosalvador
Copy link
Member

Description

Scenarios Tested

Sample Commands

Comment on lines 542 to 546
if (frameworksBackend && framework === "next") {
if (await isUsingImageOptimization(getProjectPath(), ".next")) {
frameworksBackend.memory = "512MiB";
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of doing it here, I’d move this to the Next.js files and return frameworksBackend overrides from ɵcodegenFunctionsDirectory, @jamesdaniels WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I refactored this to do it in the Next.js file.

@@ -538,6 +539,12 @@ ${

// TODO move to templates

if (frameworksBackend && framework === "next") {
if (await isUsingImageOptimization(getProjectPath(), ".next")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't we need to do this only for Next 15?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The memory issue is happening on Next 14 and 13 as well 🫠

src/frameworks/index.ts Outdated Show resolved Hide resolved
Comment on lines +542 to +543
...functionsDirectoryFrameworksBackend,
...frameworksBackend,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think functionsDirectoryFrameworksBackend should come after so it can override the default values?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking that the user could set the memory to a higher value, in that case we should not override it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants