I'm getting this error after running emulators and going to localhost:5000
GET http://localhost:5000/
net::ERR_CONTENT_DECODING_FAILED 200 (OK)
I've functions in the root directory and nextJS app in (src) directory.
I build nextjs app in root directory inside (.next) and then I run it using firebase emulators but I'm getting this error and nothing shows up.
const {default: next} = require("next");
const functions = require("firebase-functions");
// Next JS Build Directory Server Setup
//const nextJSDistDir = join("src", require("./src/next.config.js").distDir); // src/../.next
const isDev = process.env.NODE_ENV !== "production";
const nextjsServer = next({
dev: isDev,
conf: {
distDir: ".next",
}
});
const nextjsHandle = nextjsServer.getRequestHandler();
exports.nextjsFunc = functions.https.onRequest((req, res) => {
return nextjsServer.prepare().then(() => nextjsHandle(req, res));
})
module.exports = {
distDir: '../.next',
}
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"function": "nextjsFunc"
}
]
},
"functions": {
"source": ".",
"runtime": "nodejs12"
},
"emulators": {
"functions": {
"port": 5001
},
"hosting": {
"port": 5000
},
"ui": {
"enabled": true
}
}
}
question from:
https://stackoverflow.com/questions/65876548/how-to-find-nextjs-encoding-error-with-firebase 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…