When i try to render nuxt in firebase functions, i get an "User code failed to load. Cannot determine backend specification" error.
Other functions can be deployed, but only the nuxt function fails whether the mode is SSR or SPA.
I looked at the logs and found no useful information.
And when i looked into the "Cannot determine backend specification" error, i couldn't find anyone else with the same error, so i couldn't figure out a solution myself.
If anyone can help me, I would appreciate it if you could tell me how to solve this problem.
Thank you.
functions/index.js:
const functions = require('firebase-functions')
const { Nuxt } = require('nuxt')
const config = require('./nuxt.config.js')
const nuxt = new Nuxt(config)
exports.nuxtServer = functions.https.onRequest(async (request, response) => {
const result = await nuxt.renderRoute(request.originalUrl, { request })
response.send(result.html)
})
functions/package.json:
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"build": "nuxt build",
"serve": "npm run build && firebase serve --only functions",
"shell": "npm run build && firebase functions:shell",
"start": "nuxt start",
"dev": "nuxt",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log",
"generate": "nuxt generate"
},
"engines": {
"node": "14"
},
"main": "index.js",
"dependencies": {
"@nuxtjs/axios": "^5.13.6",
"core-js": "^3.19.3",
"firebase": "^9.10.0",
"firebase-admin": "^10.0.2",
"firebase-functions": "^3.18.0",
"nuxt": "^2.15.8",
"vue": "^2.6.14",
"vue-server-renderer": "^2.6.14",
"vue-template-compiler": "^2.6.14",
"vuetify": "^2.6.1",
"webpack": "^4.46.0"
},
"devDependencies": {
"firebase-functions-test": "^0.2.0",
"@nuxtjs/vuetify": "^1.12.3"
},
"private": true
}