1
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?

【React / Next.js】include a call to the setupDevPlatform function in your config file の解決方法について

Posted at

はじめに

udemyのNext.jsハンズオンでデータベースから情報を取得する実装中に下記のエラーに遭遇しましたので、こちらの解決方法について記事にします。
前提条件として、ハンズオンではSupabaseによるAPIでのデータを取得しておりますが、今回CloudflareのD1で試みております。

エラー内容:

For local development (using the Next.js dev server) remember to include
a call to the setupDevPlatform function in your config file.

For more details visit:
https://github.com/cloudflare/next-on-pages/tree/3846730c/internal-packages/next-dev

翻訳:ローカル開発(Next.js 開発サーバーを使用)の場合は、設定ファイルに setupDevPlatform 関数の呼び出しを含めることを忘れないでください。

詳細については、以下をご覧ください。
https://github.com/cloudflare/next-on-pages/tree/3846730c/internal-packages/next-dev

初期化ができていなかったようでした。

以下を追加

.next.config.ts
if (process.env.NODE_ENV === "development") {
  require("@cloudflare/next-on-pages/next-dev").setupDevPlatform();
}

※ next.config.mjsなら

.next.config.mjs
if (process.env.NODE_ENV === 'development') {
	setupDevPlatform();
}

おわりに

これでこちらのエラーは解決することができました。

JISOUのメンバー募集中!

プログラミングコーチングJISOUでは、新たなメンバーを募集しています。
日本一のアウトプットコミュニティでキャリアアップしませんか?
興味のある方は、ぜひホームページをのぞいてみてください!
▼▼▼

1
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
1
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?