Skip to content

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

Closed
@pozsa

Description

@pozsa

Describe the Bug

Any ideas or pointers on the below error msg?

error msg

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

> [email protected] 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions