FirebaseExtended / action-hosting-deploy

Automatically deploy shareable previews for your Firebase Hosting sites
https://firebase.google.com/docs/hosting/github-integration
Apache License 2.0
695 stars 202 forks source link

[BUG] [vite-plugin-pwa:build] Cannot read properties of null (reading 'tagName') #308

Closed Eliav2 closed 12 months ago

Eliav2 commented 1 year ago

the repo at the point which the build fails: https://github.com/Eliav2/justSplitIt/tree/f6fa93bb4dde3410ca19b3dff5eb64e9ee6a82d3

I'm guessing this is related to these lines

this syntax:

import { ReactComponent as JLightIcon } from '@/assets/icons/j-light.svg';

is allowed by plugins vite-plugin-svgr that tells vite how to bundle SVG elements. I think that this action does not correctly respect this setting in vite but I'm not sure.

Action config

      - uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: '${{ secrets.GITHUB_TOKEN }}'
          firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_JUST_SPLITIT }}'
          channelId: live
          projectId: just-splitit
          entryPoint: packages/just-split-it
        env:
          FIREBASE_CLI_EXPERIMENTS: webframeworks

Error message

vite v4.4.7 building for production...
  transforming...
  ✓ 1199 modules transformed.
  [vite-plugin-pwa:build] Cannot read properties of null (reading 'tagName')
  file: /home/runner/work/justSplitIt/justSplitIt/packages/just-split-it/src/assets/icons/j-light.svg
  ***
    "status": "error",
    "error": "Cannot read properties of null (reading 'tagName')"

image

full error logs:

Deploying to production site
  /opt/hostedtoolcache/node/17.9.1/x64/bin/npx firebase-tools@latest deploy --only hosting --project just-splitit --json
  npm WARN exec The following package was not found and will be installed: firebase-tools@latest
  npm WARN deprecated har-validator@5.1.5: this library is no longer supported
  npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
  npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
  vite v4.4.7 building for production...
  transforming...
  ✓ 1199 modules transformed.
  [vite-plugin-pwa:build] Cannot read properties of null (reading 'tagName')
  file: /home/runner/work/justSplitIt/justSplitIt/packages/just-split-it/src/assets/icons/j-light.svg
  ***
    "status": "error",
    "error": "Cannot read properties of null (reading 'tagName')"
  ***vite v4.4.7 building for production...
  transforming...
  ✓ 1199 modules transformed.
  ***
    "status": "error",
    "error": "Cannot read properties of null (reading 'tagName')"
  ***
  The process '/opt/hostedtoolcache/node/17.9.1/x64/bin/npx' failed with exit code 2
  Retrying deploy with the --debug flag for better error output
  /opt/hostedtoolcache/node/17.9.1/x64/bin/npx firebase-tools@latest deploy --only hosting --project just-splitit --debug
  [2023-09-20T09:24:06.300Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
  [2023-09-20T09:24:06.462Z] [iam] checking project just-splitit for permissions ["firebase.projects.get","firebasehosting.sites.update"]
  [2023-09-20T09:24:06.464Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects/just-splitit:testIamPermissions [none]
  [2023-09-20T09:24:06.464Z] >>> [apiv2][(partial)header] POST https://cloudresourcemanager.googleapis.com/v1/projects/just-splitit:testIamPermissions x-goog-quota-user=projects/just-splitit
  [2023-09-20T09:24:06.465Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/just-splitit:testIamPermissions ***"permissions":["firebase.projects.get","firebasehosting.sites.update"]***
  [2023-09-20T09:24:06.5[47](https://github.com/Eliav2/justSplitIt/actions/runs/6246596482/job/16957496516#step:6:50)Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects/just-splitit:testIamPermissions 200
  [2023-09-20T09:24:06.547Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/just-splitit:testIamPermissions ***"permissions":["firebase.projects.get","firebasehosting.sites.update"]***
  [2023-09-20T09:24:06.549Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/just-splitit [none]
  [2023-09-20T09:24:06.809Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/just-splitit 200
  [2023-09-20T09:24:06.809Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/just-splitit ***"projectId":"just-splitit","projectNumber":"1077756061576","displayName":"Just-SplitIt","name":"projects/just-splitit","resources":***"hostingSite":"just-splitit"***,"state":"ACTIVE","etag":"1_faf59bcf-002e-[48](https://github.com/Eliav2/justSplitIt/actions/runs/6246596482/job/16957496516#step:6:51)05-8227-4a40528de02d"***
  [2023-09-20T09:24:17.484Z] >>> [apiv2][query] GET https://firebasehosting.googleapis.com/v1beta1/projects/just-splitit/sites pageToken=&pageSize=10
  [2023-09-20T09:24:18.075Z] <<< [apiv2][status] GET https://firebasehosting.googleapis.com/v1beta1/projects/just-splitit/sites 200
  [2023-09-20T09:24:18.075Z] <<< [apiv2][body] GET https://firebasehosting.googleapis.com/v1beta1/projects/just-splitit/sites ***"sites":[***"name":"projects/just-splitit/sites/just-splitit","defaultUrl":"https://just-splitit.web.app","appId":"1:1077756061576:web:a19b48a7730ebc5343fc3d","type":"DEFAULT_SITE"***]***
  [2023-09-20T09:24:18.076Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/-/webApps/1:1077756061576:web:a19b48a7730ebc5343fc3d/config [none]
  [2023-09-20T09:24:18.[49](https://github.com/Eliav2/justSplitIt/actions/runs/6246596482/job/16957496516#step:6:52)2Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/-/webApps/1:1077756061576:web:a19b48a7730ebc5343fc3d/config 200
  [2023-09-20T09:24:18.492Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/-/webApps/1:1077756061576:web:a19b48a7730ebc5343fc3d/config ***"projectId":"just-splitit","appId":"1:1077756061576:web:a19b48a7730ebc5343fc3d","storageBucket":"just-splitit.appspot.com","apiKey":"AIzaSyAAOwFSClHo4dMZeD93oVRKfTrgiXqh7eE","authDomain":"just-splitit.firebaseapp.com","messagingSenderId":"1077756061576","measurementId":"G-7JLS3BW791"***

     Thank you for trying our experimental support for React on Firebase Hosting.
     While this integration is maintained by Googlers it is not a supported Firebase product.
     Issues filed on GitHub will be addressed on a best-effort basis by maintainers and other community members.

     Documentation: https://firebase.google.com/docs/hosting/frameworks/frameworks-overview
     File a bug: https://github.com/firebase/firebase-tools/issues/new?template=bug_report.md
     Submit a feature request: https://github.com/firebase/firebase-tools/issues/new?template=feature_request.md

     We'd love to learn from you. Express your interest in helping us shape the future of Firebase Hosting: https://goo.gle/41enW5X

  vite v4.4.7 building for production...
  transforming...
  ✓ 1199 modules transformed.
  [vite-plugin-pwa:build] Cannot read properties of null (reading 'tagName')
  file: /home/runner/work/justSplitIt/justSplitIt/packages/just-split-it/src/assets/icons/j-light.svg
  [2023-09-20T09:24:[51](https://github.com/Eliav2/justSplitIt/actions/runs/6246596482/job/16957496516#step:6:54).795Z] TypeError: Cannot read properties of null (reading 'tagName')
      at Object.parse (/home/runner/work/justSplitIt/justSplitIt/packages/just-split-it/node_modules/.pnpm/svg-parser@2.0.4/node_modules/svg-parser/dist/svg-parser.umd.js:279:15)
      at jsxPlugin (/home/runner/work/justSplitIt/justSplitIt/packages/just-split-it/node_modules/.pnpm/@svgr+plugin-jsx@7.0.0/node_modules/@svgr/plugin-jsx/dist/index.js:57:30)
      at run (/home/runner/work/justSplitIt/justSplitIt/packages/just-split-it/node_modules/.pnpm/@svgr+core@7.0.0_typescript@5.1.6/node_modules/@svgr/core/dist/index.js:174:16)
      at transform (/home/runner/work/justSplitIt/justSplitIt/packages/just-split-it/node_modules/.pnpm/@svgr+core@7.0.0_typescript@5.1.6/node_modules/@svgr/core/dist/index.js:180:10)
      at async Object.transform (/home/runner/work/justSplitIt/justSplitIt/packages/just-split-it/node_modules/.pnpm/vite-plugin-svgr@3.2.0_rollup@2.79.1_typescript@5.1.6_vite@4.4.7/node_modules/vite-plugin-svgr/dist/index.cjs:41:39)
      at async transform (file:///home/runner/work/justSplitIt/justSplitIt/packages/just-split-it/node_modules/.pnpm/rollup@3.26.3/node_modules/rollup/dist/es/shared/node-entry.js:24243:16)
      at async ModuleLoader.addModuleSource (file:///home/runner/work/justSplitIt/justSplitIt/packages/just-split-it/node_modules/.pnpm/rollup@3.26.3/node_modules/rollup/dist/es/shared/node-entry.js:24443:30)

  Error: An unexpected error has occurred.
  [2023-09-20T09:24:06.300Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
  [2023-09-20T09:24:06.462Z] [iam] checking project just-splitit for permissions ["firebase.projects.get","firebasehosting.sites.update"]
  [2023-09-20T09:24:06.464Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects/just-splitit:testIamPermissions [none]
  [2023-09-20T09:24:06.464Z] >>> [apiv2][(partial)header] POST https://cloudresourcemanager.googleapis.com/v1/projects/just-splitit:testIamPermissions x-goog-quota-user=projects/just-splitit
  [2023-09-20T09:24:06.465Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/just-splitit:testIamPermissions ***"permissions":["firebase.projects.get","firebasehosting.sites.update"]***
  [2023-09-20T09:24:06.547Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects/just-splitit:testIamPermissions 200
  [2023-09-20T09:24:06.547Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/just-splitit:testIamPermissions ***"permissions":["firebase.projects.get","firebasehosting.sites.update"]***
  [2023-09-20T09:24:06.549Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/just-splitit [none]
  [2023-09-20T09:24:06.809Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/just-splitit 200
  [2023-09-20T09:24:06.809Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/just-splitit ***"projectId":"just-splitit","projectNumber":"1077756061576","displayName":"Just-SplitIt","name":"projects/just-splitit","resources":***"hostingSite":"just-splitit"***,"state":"ACTIVE","etag":"1_faf59bcf-002e-4805-8227-4a40[52](https://github.com/Eliav2/justSplitIt/actions/runs/6246596482/job/16957496516#step:6:55)8de02d"***
  [2023-09-20T09:24:17.484Z] >>> [apiv2][query] GET https://firebasehosting.googleapis.com/v1beta1/projects/just-splitit/sites pageToken=&pageSize=10
  [2023-09-20T09:24:18.075Z] <<< [apiv2][status] GET https://firebasehosting.googleapis.com/v1beta1/projects/just-splitit/sites 200
  [2023-09-20T09:24:18.075Z] <<< [apiv2][body] GET https://firebasehosting.googleapis.com/v1beta1/projects/just-splitit/sites ***"sites":[***"name":"projects/just-splitit/sites/just-splitit","defaultUrl":"https://just-splitit.web.app","appId":"1:1077756061576:web:a19b48a7730ebc5343fc3d","type":"DEFAULT_SITE"***]***
  [2023-09-20T09:24:18.076Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/-/webApps/1:1077756061576:web:a19b48a7730ebc5343fc3d/config [none]
  [2023-09-20T09:24:18.492Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/-/webApps/1:1077756061576:web:a19b48a7730ebc5343fc3d/config 200
  [2023-09-20T09:24:18.492Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/-/webApps/1:1077756061576:web:a19b48a7730ebc5343fc3d/config ***"projectId":"just-splitit","appId":"1:1077756061576:web:a19b48a7730ebc5343fc3d","storageBucket":"just-splitit.appspot.com","apiKey":"AIzaSyAAOwFSClHo4dMZeD93oVRKfTrgiXqh7eE","authDomain":"just-splitit.firebaseapp.com","messagingSenderId":"1077756061576","measurementId":"G-7JLS3BW791"***

     Thank you for trying our experimental support for React on Firebase Hosting.
     While this integration is maintained by Googlers it is not a supported Firebase product.
     Issues filed on GitHub will be addressed on a best-effort basis by maintainers and other community members.

     Documentation: https://firebase.google.com/docs/hosting/frameworks/frameworks-overview
     File a bug: https://github.com/firebase/firebase-tools/issues/new?template=bug_report.md
     Submit a feature request: https://github.com/firebase/firebase-tools/issues/new?template=feature_request.md

     We'd love to learn from you. Express your interest in helping us shape the future of Firebase Hosting: https://goo.gle/41enW5X

  vite v4.4.7 building for production...
  transforming...
  ✓ 1199 modules transformed.
  [2023-09-20T09:24:51.795Z] TypeError: Cannot read properties of null (reading 'tagName')
      at Object.parse (/home/runner/work/justSplitIt/justSplitIt/packages/just-split-it/node_modules/.pnpm/svg-parser@2.0.4/node_modules/svg-parser/dist/svg-parser.umd.js:279:15)
      at jsxPlugin (/home/runner/work/justSplitIt/justSplitIt/packages/just-split-it/node_modules/.pnpm/@svgr+plugin-jsx@7.0.0/node_modules/@svgr/plugin-jsx/dist/index.js:[57](https://github.com/Eliav2/justSplitIt/actions/runs/6246596482/job/16957496516#step:6:60):30)
      at run (/home/runner/work/justSplitIt/justSplitIt/packages/just-split-it/node_modules/.pnpm/@svgr+core@7.0.0_typescript@5.1.6/node_modules/@svgr/core/dist/index.js:174:16)
      at transform (/home/runner/work/justSplitIt/justSplitIt/packages/just-split-it/node_modules/.pnpm/@svgr+core@7.0.0_typescript@5.1.6/node_modules/@svgr/core/dist/index.js:180:10)
      at async Object.transform (/home/runner/work/justSplitIt/justSplitIt/packages/just-split-it/node_modules/.pnpm/vite-plugin-svgr@3.2.0_rollup@2.79.1_typescript@5.1.6_vite@4.4.7/node_modules/vite-plugin-svgr/dist/index.cjs:41:39)
      at async transform (file:///home/runner/work/justSplitIt/justSplitIt/packages/just-split-it/node_modules/.pnpm/rollup@3.26.3/node_modules/rollup/dist/es/shared/node-entry.js:24243:16)
      at async ModuleLoader.addModuleSource (file:///home/runner/work/justSplitIt/justSplitIt/packages/just-split-it/node_modules/.pnpm/rollup@3.26.3/node_modules/rollup/dist/es/shared/node-entry.js:24443:30)

  Error: An unexpected error has occurred.

  The process '/opt/hostedtoolcache/node/17.9.1/x64/bin/npx' failed with exit code 2
  Error: The process '/opt/hostedtoolcache/node/17.9.1/x64/bin/npx' failed with exit code 2
  ***
    conclusion: 'failure',
    output: ***
      title: 'Deploy preview failed',
      summary: "Error: The process '/opt/hostedtoolcache/node/17.9.1/x[64](https://github.com/Eliav2/justSplitIt/actions/runs/6246596482/job/16957496516#step:6:67)/bin/npx' failed with exit code 2"
    ***
  ***

Expected behavior

build should work on cicd, because running vite builld locally works fine.

Actual behavior

vite build fails when running via the FirebaseExtended/action-hosting-deploy@v0 action

Eliav2 commented 12 months ago

hey. seems that the issue was related that not all files was cloned. in my case, some files was stored under Github LFS files. so to insure that why would be cloned in the CICD pipeline i had to make sure that LFS files would be included also. This issue is not related this project. thanks for awesome action!

      - uses: actions/checkout@v3
        with:
          lfs: true  # This flag ensures that Git LFS is enabled during the checkout process