3

I am trying to deploy nuxtjs app as cloud function on Firebase following this tutorial. I am able to deploy everything (functions and hosting). However, when I try to open the page browser displays Error: could not handle the request.

In the function logs I see the following error: FATAL Cannot resolve "~/graphql/index.js" from "/workspace/graphql/index.js".

The path that fails to be resolved is specified in nuxt.config.js in serverMiddleware:

 serverMiddleware: [{ path: '/graphql', handler: '~/graphql/index.js' }],

I tried using ./ instead of ~/ but it changes nothing. I also tried this approach, but it also makes no change, same error is thrown. Obviously dev server runs correctly.

Although the middleware is a graphql one I don't think it's a graphql problem, so no graphql tag at the moment.

Does anyone know how to set up a nuxt server middleware so that Firebase can resolve it?

Eggon
  • 2,032
  • 2
  • 19
  • 38
  • Hey! I'm going through. the exact same issue. Have you found a solution ? Can you share it please if you did ? – Medteck Jul 19 '22 at 20:17
  • @Medteck It was year ago, so don't remember, but I had a quick look into the code and I see that I have this serverMiddleware line commented out, which means I simply didn't do it as server middleware if that is of any help. – Eggon Jul 20 '22 at 15:23

0 Answers0