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

[next] Support Edge API Endpoints #7905

Merged
merged 7 commits into from
Jun 7, 2022
Merged

[next] Support Edge API Endpoints #7905

merged 7 commits into from
Jun 7, 2022

Conversation

Schniz
Copy link
Contributor

@Schniz Schniz commented Jun 1, 2022

Related Issues

📋 Checklist

Tests

  • The code changed/added as part of this PR has been covered with tests
  • All tests pass locally with yarn test-unit

Code Review

  • This PR has a concise title and thorough description useful to a reviewer
  • Issue from task tracker has a link to this PR

for (const edgeFunctionFile of Object.keys(
middlewareManifest?.functions ?? {}
)) {
delete pages[edgeFunctionFile.slice(1) + '.js'];
Copy link
Member

Choose a reason for hiding this comment

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

Are we planning to add an error when runtime: 'edge' is used with a getStaticProps page? Currently it isn't compatible with the Prerender type as it expects the lambda output so will break for that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good question, but right now with vercel/next.js#37481 it's only going to be api endpoints and not pages, so Prerender is not expected to be emitted for this output.

cc @shuding that mentioned some work related to pages 👀

Copy link
Member

Choose a reason for hiding this comment

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

Might be good to add an invariant here to ensure we only delete API pages for now to be safe then

Copy link
Member

@shuding shuding Jun 7, 2022

Choose a reason for hiding this comment

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

Although we don't have FS in the edge runtime, we still allow getStaticProps together with runtime: 'edge'. It's just that it currently behaves like SSR.

Copy link
Member

Choose a reason for hiding this comment

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

Soon we will have to remove this constraint as we're refactoring the edge SSR implementation to use functions here :)

@Schniz
Copy link
Contributor Author

Schniz commented Jun 7, 2022

@ijjk can you re-review?

@Schniz Schniz merged commit 701a02a into main Jun 7, 2022
@Schniz Schniz deleted the support-edge-api-endpoints branch June 7, 2022 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants