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] Unexpected token r in JSON at position 2 #359

Open nvzoll opened 5 months ago

nvzoll commented 5 months ago

Action config

jobs:
    build_and_deploy:
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v3
            - run: |
                  export NODE_OPTIONS=--max_old_space_size=4096
                  npm ci && npm run build
            - uses: FirebaseExtended/action-hosting-deploy@v0
              with:
                  repoToken: '${{ secrets.GITHUB_TOKEN }}'
                  firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}'
                  channelId: live
                  projectId: ...
                  target: ...
              env:
                  FIREBASE_CLI_EXPERIMENTS: webframeworks
                  NODE_OPTIONS: "--max_old_space_size=4096"

Error message

Github action log

Run FirebaseExtended/action-hosting-deploy@v0
Verifying firebase.json exists
Setting up CLI credentials
Deploying to production site
  /usr/local/bin/npx firebase-tools@latest deploy --only hosting:...--project ... --json
  npm WARN exec The following package was not found and will be installed: firebase-tools@13.6.0
  No Firebase app associated with site ..., injecting project default config.
    You can link a Web app to a Hosting site here https://console.firebase.google.com/project/.../settings/general/web
  info  - Loaded env from /home/runner/work/.../.env
  info  - SWC minify release candidate enabled. https://nextjs.link/swcmin
  info  - SWC minify release candidate enabled. https://nextjs.link/swcmin
  info  - SWC minify release candidate enabled. https://nextjs.link/swcmin
  npm WARN deprecated har-validator@5.1.5: this library is no longer supported
  npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
  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.
  npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
  npm WARN deprecated vm2@3.9.[19](https://github.com/.../actions/runs/.../job/...#step:4:22): The library contains critical security issues and should not be used for production! The maintenance of the project has been discontinued. Consider migrating your code to isolated-vm.

  added 1405 packages in 26s

  181 packages are looking for funding
    run `npm fund` for details
  Error: Unexpected token r in JSON at position 2
  ***
    conclusion: 'failure',
    output: ***
      title: 'Deploy preview failed',
      summary: 'Error: Unexpected token r in JSON at position 2'
    ***
  ***

Expected behavior

Workflow run ends successfully

Actual behavior

Workflow run fails, but usually successfully deploys after manual restart.

renzodamgo commented 5 months ago

I got the same error, it was working perfectly fine yesterday.

Deploying to production site
  /usr/local/bin/npx firebase-tools@latest deploy --only hosting --project inet-2-dfbff --json
  npm WARN exec The following package was not found and will be installed: firebase-tools@13.6.0
  No Firebase app associated with site inet-2-dfbff, injecting project default config.
    You can link a Web app to a Hosting site here https://console.firebase.google.com/project/inet-2-dfbff/settings/general/web
  - Building...

  Browser bundles        
  Initial chunk files     | Names               |  Raw size | Estimated transfer size
  main-YN6LQCWE.js        | main                | 517.66 kB |               127.30 kB
  scripts-WGNF5RAP.js     | scripts             | 158.85 kB |                48.57 kB
  styles-4XHX5U2Z.css     | styles              |  40.58 kB |                 6.89 kB
  polyfills-CG2UM2YX.js   | polyfills           |  33.96 kB |                11.03 kB

                          | Initial total       | 751.05 kB |               193.78 kB

  Server bundles         
  Initial chunk files     | Names               |  Raw size
  server.mjs              | server              |   1.04 MB |                        
  chunk-DOITE7MV.mjs      | -                   | 589.37 kB |                        
  polyfills.server.mjs    | polyfills.server    | 262.41 kB |                        
  chunk-LTK7J63Z.mjs      | -                   | 181.51 kB |                        
  chunk-K7YHPIF3.mjs      | -                   |   2.83 kB |                        
  render-utils.server.mjs | render-utils.server |   1.43 kB |                        
  main.server.mjs         | main.server         | 149 bytes |                        

  Lazy chunk files        | Names               |  Raw size
  chunk-GY55LZEE.mjs      | xhr2                |  11.80 kB |                        

  Prerendered 15 static routes.
  Output location: /home/runner/work/inet-v2/inet-v2/dist/inet-v2

  Application bundle generation complete. [35.462 seconds]

  Warning: G] bundle initial exceeded maximum budget. Budget 500.00 kB was not met by 251.05 kB with a total of 751.05 kB.

  Warning: G] 2 rules skipped due to selector errors:
    ::view-transition-old(body-transition) -> Pseudo-elements are not supported by css-select
    ::view-transition-new(body-transition) -> Pseudo-elements are not supported by css-select

  added 338 packages in 9s

  28 packages are looking for funding
    run `npm fund` for details
  Error: Unexpected token r in JSON at position 2
  ***
    conclusion: 'failure',
    output: ***
      title: 'Deploy preview failed',
      summary: 'Error: Unexpected token r in JSON at position 2'
    ***
  ***