Skip to content

fix: next request check for serverless environments #14466

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

Merged
merged 2 commits into from
Jul 18, 2025
Merged

Conversation

soberm
Copy link
Contributor

@soberm soberm commented Jul 14, 2025

Description of changes

The instanceof Request type guard check fails in AWS Lambda environments (specifically with OpenNext/SST
deployments). The problem causes authentication API routes to work on cold Lambda starts but fail on subsequent warm invocations with a 500 error: "Invalid request and context/response
combination. The request cannot be handled." This PR changes the check to use duck typing to prevent possible constructor references to differ between invocations.

Issue #, if available

14455

Description of how you validated changes

  • Units tests
  • Deployed sample app and verified manually
  • E2E test run successfull
    ** Failing tests unrelated

Checklist

  • PR description included
  • yarn test passes
  • Unit Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

Checklist for repo maintainers

  • Verify E2E tests for existing workflows are working as expected or add E2E tests for newly added workflows
  • New source file paths included in this PR have been added to CODEOWNERS, if appropriate

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@soberm soberm marked this pull request as ready for review July 14, 2025 13:10
@soberm soberm merged commit 7624f7c into main Jul 18, 2025
30 checks passed
@soberm soberm deleted the fix/next_request_check branch July 18, 2025 04:46
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