Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
385 views
in Technique[技术] by (71.8m points)

google cloud firestore - How to find NextJS encoding error with Firebase?

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.

enter image description here

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...