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

オープン
#1,240 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
node.js, typescript
領域
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分
マージ済み PR(30日)
2

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

vercel/examples のほかの issue

vercel/examples の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。