I Develop a Gatsby Blog where i use firebase authentication and its work perfect locally on my pc but when i deploy it on netlify it show me an error .
Please Help me it’s working locally but not on netlify !!
10:16:39 PM: failed Building static HTML for pages - 6.848s
10:16:39 PM: error Building static HTML failed for path “/developer/Zia Khan”
10:16:39 PM:
10:16:39 PM: 29 | const [UserActivity, SetuserActivity] = useState();
10:16:39 PM: 30 |
10:16:39 PM: > 31 | firebase.auth().onAuthStateChanged(function (user) {
10:16:39 PM: | ^
10:16:39 PM: 32 | if (user) {
10:16:39 PM: 33 | // User is signed in.
10:16:39 PM: 34 | SetuserActivity(true);
10:16:39 PM:
10:16:39 PM: WebpackError: TypeError: gatsby_plugin_firebase__WEBPACK_IMPORTED_MODULE_5__.d efault.auth is not a function
10:16:39 PM:
10:16:39 PM: - developer.js:31
10:16:39 PM: src/templates/developer.js:31:14
10:16:39 PM:
10:16:39 PM: - arrayLikeToArray.js:1
10:16:39 PM: node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js:1:1
10:16:39 PM:
10:16:39 PM:
10:16:39 PM:
10:16:39 PM: ────────────────────────────────────────────────────────────────
10:16:39 PM: “build.command” failed
10:16:39 PM: ────────────────────────────────────────────────────────────────
10:16:39 PM:
10:16:39 PM: Error message
10:16:39 PM: Command failed with exit code 1: gatsby build
10:16:39 PM:
10:16:39 PM: Error location
10:16:39 PM: In build.command from netlify.toml:
10:16:39 PM: gatsby build
10:16:39 PM:
10:16:39 PM: Resolved config
10:16:39 PM: build:
10:16:39 PM: command: gatsby build
10:16:39 PM: commandOrigin: config
10:16:39 PM: environment:
10:16:39 PM: - DC_SPACEID
10:16:39 PM: - DC_TOKEN
10:16:39 PM: publish: /opt/build/repo/public
10:16:39 PM: Caching artifacts
10:16:39 PM: Started saving node modules
10:16:39 PM: Finished saving node modules
10:16:39 PM: Started saving build plugins
10:16:39 PM: Finished saving build plugins
10:16:39 PM: Started saving pip cache
10:16:39 PM: Finished saving pip cache
10:16:39 PM: Started saving emacs cask dependencies
10:16:39 PM: Finished saving emacs cask dependencies
10:16:39 PM: Started saving maven dependencies
10:16:39 PM: Finished saving maven dependencies
10:16:39 PM: Started saving boot dependencies
10:16:39 PM: Finished saving boot dependencies
10:16:39 PM: Started saving go dependencies
10:16:39 PM: Finished saving go dependencies
10:16:39 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:16:39 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2
10:16:39 PM: Failing build: Failed to build site
10:16:39 PM: Finished processing build request in 1m33.073795957s