Hono on Vercel example throws 502 when running `vercel dev`

未关闭
#1,240 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
领域
cloud, devtools

调研方向

从 package.json 和 src/index.ts 开始,然后使用 hono-on-vercel 示例通过 vercel dev 重现该故障。将本地使用的 TypeScript 版本和编译器选项与 Vercel 开发运行时使用的版本和选项进行比较。当该示例能够在本地启动,并且 http://localhost:3000 不再返回 502 时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

Context

The hono-on-vercel works as expected when using the 1-click "Deploy" button on Vercel. But pull down the repository, make no changes, run vercel dev, and then go to http://localhost:3000 and it immediately throws 502 Bad Gateway.

Response
502: BAD_GATEWAY
Code: NO_RESPONSE_FROM_FUNCTION
Error output
> Ready! Available at http://localhost:3000
/Users/lance/Library/pnpm/global/5/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/src/index.ts:859
    return new TSError(diagnosticText, diagnosticCodes, diagnostics);
           ^
TSError: ⨯ Unable to compile TypeScript:
error TS5023: Unknown compiler option 'verbatimModuleSyntax'.

    at createTSError (/Users/lance/Library/pnpm/global/5/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/src/index.ts:859:12)
    at reportTSError (/Users/lance/Library/pnpm/global/5/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/src/index.ts:863:19)
    at createFromPreloadedConfig (/Users/lance/Library/pnpm/global/5/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/src/index.ts:874:36)
    at create (/Users/lance/Library/pnpm/global/5/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/src/index.ts:624:10)
    at Object.register (/Users/lance/Library/pnpm/global/5/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/src/index.ts:591:15)
    at Object.<anonymous> (/Users/lance/Library/pnpm/global/5/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/register/index.js:1:16)
    at Module._compile (node:internal/modules/cjs/loader:1706:14)
    at Object..js (node:internal/modules/cjs/loader:1839:10)
    at Module.load (node:internal/modules/cjs/loader:1441:32)
    at Function._load (node:internal/modules/cjs/loader:1263:12) {
  diagnosticCodes: [ 5023 ]
}
Error: Function `src/index.ts` failed with exit code 1
Steps to reproduce
  • Go to https://vercel.com/templates/backend/hono-on-vercel
  • Click the black Deploy button in the upper right corner of the page next to the View Demo button
  • Connect via a Provider (I used GitHub)
  • Give the repo a name, select a Team, and click the Create button
  • Watch Vercel build and deploy the project
  • Continue to Vercel Dashboard, find the Domain, and open the hono app to verify it works as expected ✅
  • Click the Repository button in the upper right
  • Clone the git repo to local machine and cd into the project
  • run vercel dev
  • Set up and develop: Y
  • Select Vercel scope
  • Link to the project it finds: Y
  • Server starts up: Ready! Available at http://localhost:3000
  • Navigate to http://localhost:3000
  • A 502 Bad Gateway response is served and the error above is logged
Possible Diagnosis

Why does Vercel 48.1.6 (latest) install typescript 4.9.5 despite package.json specifies "typescript": "^5.8.3". The TypeScript flag verbatimModuleSyntax is only available in v5+.

% pnpm why --global typescript
Legend: production dependency, optional only, dev only

/Users/lance/Library/pnpm/global/5

dependencies:
vercel 48.1.6
├─┬ @vercel/express 0.0.22
│ └─┬ @vercel/node 5.3.24
│   ├─┬ ts-node 10.9.1
│   │ └── typescript 4.9.5 peer
│   └── typescript 4.9.5
├─┬ @vercel/h3 0.1.2
│ └─┬ @vercel/node 5.3.24
│   ├─┬ ts-node 10.9.1
│   │ └── typescript 4.9.5 peer
│   └── typescript 4.9.5
├─┬ @vercel/hono 0.1.2
│ └─┬ @vercel/node 5.3.24
│   ├─┬ ts-node 10.9.1
│   │ └── typescript 4.9.5 peer
│   └── typescript 4.9.5
└─┬ @vercel/node 5.3.24
  ├─┬ ts-node 10.9.1
  │ └── typescript 4.9.5 peer
  └── typescript 4.9.5
主要语言
TypeScript
星标
5.2k
派生
1.9k
平均合并
1 小时 4 分钟
30 天内合并 PR
2

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

vercel/examples 的其他 Issue

查看 vercel/examples 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。