FE-1631: Fix Node ESM imports in Petrinaut Vercel Functions - #9589
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryLow Risk Overview Adds a dedicated Reviewed by Cursor Bugbot for commit 7addf29. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
Preview smoke test passed on the Petrinaut deployment:
None of the routes produced |
kube
left a comment
There was a problem hiding this comment.
Thanks for discovering that.
Please check my comment on adding another tsconfig.json rather than creating unit tests to verify compilation.
Co-authored-by: Cursor <cursoragent@cursor.com>
kube
left a comment
There was a problem hiding this comment.
Thank you!
This will also solve the oEmbed issue I had to investigate. (certainly)
🌟 What is the purpose of this PR?
Petrinaut's Voice and oEmbed Vercel Functions currently fail before their handlers run because the emitted ESM retains extensionless relative imports. Native Node ESM resolution does not append
.js, so Vercel reportsERR_MODULE_NOT_FOUNDand the Voice config endpoint returns 500.This repairs the complete local runtime import graphs and adds a dedicated NodeNext TypeScript project that recursively checks every Petrinaut Vercel Function entrypoint using native Node ESM resolution rules.
🔗 Related links
🚫 Blocked by
🔍 What does this change?
.jsto relative imports used by the oEmbed, Voice config, and Voice Realtime call runtime graphs.api/tsconfig.jsonwith NodeNext resolution andverbatimModuleSyntax, recursively covering current and future Vercel Function entrypoints.lint:tsc, while limiting ambient Node types to the API project.Pre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
This PR:
📜 Does this require a change to the docs?
The changes in this PR:
🕸️ Does this require a change to the Turbo Graph?
The changes in this PR:
This restores function loading only. Petrinaut's current policy still disables OpenAI Voice in production; enabling production Voice requires the separate authentication/security work tracked by FE-1622.
🐾 Next steps
/api/voice/config,/api/voice/realtime-call, and/api/oembedon the Vercel preview.🛡 What tests cover this?
@apps/petrinaut-websiteunit-test suite.❓ How to test this?
mise exec -- turbo run build --filter='@apps/petrinaut-website'.mise exec -- yarn workspace @apps/petrinaut-website test:unit.mise exec -- yarn workspace @apps/petrinaut-website lint:tsc.FUNCTION_INVOCATION_FAILED.📹 Demo
Not applicable: this fixes serverless module loading and has no visual change.