LoginSignup
1
1

More than 3 years have passed since last update.

Lambda で動かしている Nuxt のバージョンを 2.5 に上げたときに "Cannot GET /" が返るときの対処法

Posted at

若干ハマったので共有です。

シンプルですが、公式のマイグレーションガイドを読んだら解決しました。結論、以下の処理が足りていませんでした。

   const nuxt = new Nuxt(config)
++ await nuxt.ready()

自分が動かしている環境では mya-ake/nuxt-on-lambda を参考にした構成をとっていたので、app.use(nuxt.render); としてる部分を以下のように修正すると解決しました。

app.use(async (req, res, next) => {
  await nuxt.ready();
  nuxt.render(req, res, next);
});

参考

1
1
2

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
1