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@15] unstable_after not supported #2695

Closed
pieh opened this issue Oct 23, 2024 · 0 comments · Fixed by #2717
Closed

[next@15] unstable_after not supported #2695

pieh opened this issue Oct 23, 2024 · 0 comments · Fixed by #2717
Labels
Next.js e2e test failure Errors identified through the Next.js repo e2e tests Next.js

Comments

@pieh
Copy link
Contributor

pieh commented Oct 23, 2024

We are currently unable to properly support unstable_after due to currently missing functionality in our serverless functions.

Next.js relies on waitUntil implementation being provided - see https://github.com/vercel/next.js/blob/canary/packages/next/src/server/after/builtin-request-context.ts on how to wire it up.

We would need to define globalThis[Symbol.for('@next/request-context')] context which contains waitUntil implementation.

We do currently use some tricks to allow background revalidation (which is similar case of wanting to ensure this finishes executing before lambda stops execution) by keeping connection alive, but this method doesn't play well with unstable_after because one variant of it (when function/callback is used as unstable_after argument) relies on response stream close event (while we attempt to delay it for revalidation).

See those code locations with some wiring for callback variant (there are steps skipped in between - there is quite a bit of "prop drilling" between those):

It does seem to work with doing custom close event emitting (when response is not actually "closed"), but this feels pretty hacky and might have unforseen consequences, so it's just better to wait for waitUntil to be supported in our serverless environemnt instead.

Data

The following is parsed automatically by the Next.js repo e2e test report generator.

test: test/e2e/app-dir/next-after-app-deploy/index.test.ts
reason: unstable_after not supported

@pieh pieh added the Next.js e2e test failure Errors identified through the Next.js repo e2e tests label Oct 23, 2024
@linear linear bot added the Next.js label Oct 23, 2024
@pieh pieh closed this as completed in #2717 Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Next.js e2e test failure Errors identified through the Next.js repo e2e tests Next.js
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant