0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Next.jsのプロジェクトをCloudflareにデプロイしようとしたら躓いた

Last updated at Posted at 2025-04-29

バージョンはNext.js 15

api\open-graph\route.tsで躓いた

JSDOMを使うのやめて、DOMParserを使う事にしたらエラーが解消しデプロイが通った。

しかしDOMParserでは一部機能が動かなかったため、Edge 環境向けに HTMLRewriter を使うことにした。
HTMLRewriterの場合Cloudflareのランタイム環境で動かす必要ある点に注意。

Node.js Compatibility Errorの解消

Cloudflareのプロジェクト→設定→ランタイム→互換性フラグに

nodejs_compat

を指定して保存

これでエラーが解消された。

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?