question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: Cannot read properties of undefined (reading 'log')

See original GitHub issue

Describe the Bug

Any ideas or pointers on the below error msg?

error msg

node@c32a0f966662:/usr/src/myhangar$ npm run build

> myhangar@0.0.1 build
> svelte-kit build

vite v2.7.13 building for production...
✓ 13 modules transformed.
.svelte-kit/output/client/_app/manifest.json                    1.15 KiB
.svelte-kit/output/client/_app/layout.svelte-a6119758.js        0.53 KiB / gzip: 0.35 KiB
.svelte-kit/output/client/_app/error.svelte-901088d7.js         1.56 KiB / gzip: 0.75 KiB
.svelte-kit/output/client/_app/pages/index.svelte-36add3e4.js   0.80 KiB / gzip: 0.47 KiB
.svelte-kit/output/client/_app/start-a0de9863.js                21.59 KiB / gzip: 7.35 KiB
.svelte-kit/output/client/_app/chunks/vendor-f0095a1c.js        7.21 KiB / gzip: 2.96 KiB
vite v2.7.13 building SSR bundle for production...
✓ 11 modules transformed.
.svelte-kit/output/server/manifest.json                    0.87 KiB
.svelte-kit/output/server/app.js                           56.14 KiB
.svelte-kit/output/server/entries/pages/layout.svelte.js   0.24 KiB
.svelte-kit/output/server/entries/pages/error.svelte.js    0.72 KiB
.svelte-kit/output/server/entries/pages/index.svelte.js    0.32 KiB
.svelte-kit/output/server/chunks/index-2dc61825.js         2.24 KiB

Run npm run preview to preview your production build locally.

> Using svelte-adapter-firebase
> Cannot read properties of undefined (reading 'log')
    at adapt (file:///usr/src/myhangar/node_modules/svelte-adapter-firebase/src/index.js:25:10)
    at adapt (file:///usr/src/myhangar/node_modules/@sveltejs/kit/dist/chunks/index5.js:760:8)
    at file:///usr/src/myhangar/node_modules/@sveltejs/kit/dist/cli.js:1053:11
node@c32a0f966662:/usr/src/myhangar$

firebase.json

{
  "functions": {
    "source": "functions",
    "predeploy": [
      "npm --prefix \"$RESOURCE_DIR\" run lint",
      "npm --prefix \"$RESOURCE_DIR\" run build"
    ]
  },
  "firestore": {
    "rules": "firestore.rules",
    "indexes": "firestore.indexes.json"
  },
  "hosting": {
    "public": "build",
    "ignore": ["firebase.json", "**/.*", "**/node_modules/**"]
  },
  "storage": {
    "rules": "storage.rules"
  },
  "emulators": {
    "auth": {
      "port": 9099
    },
    "functions": {
      "port": 5001
    },
    "firestore": {
      "port": 8080
    },
    "database": {
      "port": 9000
    },
    "hosting": {
      "port": 5000
    },
    "pubsub": {
      "port": 8085
    },
    "storage": {
      "port": 9199
    },
    "ui": {
      "enabled": true,
      "port": 4000
    }
  },
  "remoteconfig": {
    "template": "remoteconfig.template.json"
  }
}

svelte.config.js

import firebase from 'svelte-adapter-firebase'
import preprocess from 'svelte-preprocess'

/** @type {import('@sveltejs/kit').Config} */
const config = {
  // Consult https://github.com/sveltejs/svelte-preprocess
  // for more information about preprocessors
  preprocess: preprocess(),

  kit: {
    adapter: firebase(),

    // hydrate the <div id="svelte"> element in src/app.html
    target: '#svelte'
  }
}

export default config

package.json

{
  "name": "myhangar",
  "version": "0.0.1",
  "scripts": {
    "dev": "svelte-kit dev",
    "build": "svelte-kit build",
    "package": "svelte-kit package",
    "preview": "svelte-kit preview",
    "check": "svelte-check --tsconfig ./tsconfig.json",
    "check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
    "lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
    "format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. ."
  },
  "devDependencies": {
    "@sveltejs/adapter-auto": "^1.0.0-next.17",
    "@sveltejs/kit": "^1.0.0-next.251",
    "@typescript-eslint/eslint-plugin": "^5.10.1",
    "@typescript-eslint/parser": "^5.10.1",
    "eslint": "^7.32.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-svelte3": "^3.2.1",
    "prettier": "^2.4.1",
    "prettier-plugin-svelte": "^2.4.0",
    "svelte": "^3.44.0",
    "svelte-adapter-firebase": "^0.13.1",
    "svelte-check": "^2.2.6",
    "svelte-preprocess": "^4.9.4",
    "tslib": "^2.3.1",
    "typescript": "^4.4.3"
  },
  "type": "module",
  "dependencies": {
    "firebase": "^9.6.5"
  }
}

Steps to Reproduce

  1. init sveltkit (with ts)
  2. install svelte-adapter-firebase
  3. firebase init (with ts)
  4. update svelte.config.js
  5. npm run build

Expected Behaviour

successful build run

svelte-adapter-firebase version

0.13.1

sveltejs/kit version

1.0.0-next.251

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:7
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

13reactions
co3kcommented, Feb 22, 2022

Hello, I’ve sent a pull request to solve this problem. https://github.com/jthegedus/svelte-adapter-firebase/pull/157 Does anyone review my patch?

7reactions
mcanyucelcommented, Mar 24, 2022

Any progress?

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read properties of undefined (reading 'LOG ...
After some digging, I noticed that the error disappears and I can edit the query if either the name of the variable is...
Read more >
Cannot read properties of undefined (reading 'log'), winston
I am trying to log errors in a file using winston, node js. but it is giving the error as: Cannot read properties...
Read more >
Cannot read properties of undefined (reading 'id') - TrackJS
In this case, our code expects to have an object with a id property, but that object was not present.
Read more >
[Solved] Cannot read Properties of Undefined in JavaScript
The "Cannot read properties of undefined" error occurs when you try to access a property or a method on a variable that stores...
Read more >
How to Prevent the Error: Cannot Read Property '0' of Undefined
In practice, this could be a delay caused by having an API call, reading from a file or a database, or waiting for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found