Skip to content

Comments

fix(aws-lambda): add preview command#4052

Open
taylorfsteele wants to merge 1 commit intonitrojs:mainfrom
taylorfsteele:fix/aws-lambda-preview-command
Open

fix(aws-lambda): add preview command#4052
taylorfsteele wants to merge 1 commit intonitrojs:mainfrom
taylorfsteele:fix/aws-lambda-preview-command

Conversation

@taylorfsteele
Copy link
Contributor

🔗 Linked issue

#4051

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

Closes #4051

This PR adds a preview command for the aws-lambda preset.

In order to get the preview command working correctly, two additional changes were added:

  • The aws-lambda and streaming presets now export nitroApp.fetch.
    • I plucked this concept from presets/standard/runtime/server.ts after running into issues where the preview command was unable to load correctly. I'm very open to excluding this from the PR and moving this to a more Vite or App level concern, as I'm not entirely unsure about the ramifications of this change. I'm not exactly sure how to do that, but let me know what you think.
  • Added a shim that adds awslambda globals to the preview command.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Export fetch from aws-lambda, aws-lambda-streaming presets
Add streaming preview shim
@taylorfsteele taylorfsteele requested a review from pi0 as a code owner February 22, 2026 18:19
@vercel
Copy link

vercel bot commented Feb 22, 2026

@taylorfsteele is attempting to deploy a commit to the Nitro Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link

coderabbitai bot commented Feb 22, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

Adds AWS Lambda preset preview command support with streaming capabilities. Introduces default exports for fetch functionality in runtime presets and creates a preview shim utility for streaming mode compatibility.

Changes

Cohort / File(s) Summary
Preset Configuration
src/presets/aws-lambda/preset.ts
Adds preview command with streaming support, conditional shim import in preview input, and a compiled lifecycle hook that generates the AWS Lambda preview shim file to server output directory when streaming is enabled.
Runtime Exports
src/presets/aws-lambda/runtime/aws-lambda.ts, src/presets/aws-lambda/runtime/aws-lambda-streaming.ts
Adds default exports exposing { fetch: nitroApp.fetch } to both standard and streaming runtime presets, enabling module-level import as default module with fetch method.
Utility Constants
src/presets/aws-lambda/utils.ts
Introduces new awsLambdaPreviewShim string constant defining a minimal globalThis.awslambda compatibility shim with streamifyResponse method and HttpResponseStream.from utility for preview environments.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'fix(aws-lambda): add preview command' follows conventional commits format with a fix type and clear scope.
Description check ✅ Passed The PR description clearly explains the changes, links to issue #4051, describes the rationale for exports, and mentions the added shim.
Linked Issues check ✅ Passed The PR fully addresses issue #4051 by adding a preview command for the aws-lambda preset, enabling TanStack Start prerendering compatibility.
Out of Scope Changes check ✅ Passed All changes are directly related to adding preview command support for the aws-lambda preset, with no extraneous modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 22, 2026

Open in StackBlitz

npm i https://pkg.pr.new/nitrojs/nitro@4052

commit: 66dd034

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.

TanStack Start Prerender not working with aws-lambda preset

1 participant