action-hosting-deploy icon indicating copy to clipboard operation
action-hosting-deploy copied to clipboard

[BUG] npm package was not found (sql-formatter)

Open doum1004 opened this issue 9 months ago • 10 comments

Action config

      - uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: ${{ secrets.GITHUB_TOKEN }}
          firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
          channelId: live
          projectId: ....

Error message

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: [email protected]
  node:internal/modules/cjs/loader:643
        throw e;
        ^
  
  Error: Cannot find module '/home/runner/.npm/_npx/ba4f1959e38407b5/node_modules/sql-formatter/dist/cjs/index.cjs'
      at createEsmNotFoundErr (node:internal/modules/cjs/loader:1[24](https://github.com/..../actions/runs/13964637473/job/39092198105#step:12:27)9:15)
      at finalizeEsmResolution (node:internal/modules/cjs/loader:1237:15)
      at resolveExports (node:internal/modules/cjs/loader:636:14)
      at Module._findPath (node:internal/modules/cjs/loader:716:31)
      at Module._resolveFilename (node:internal/modules/cjs/loader:1198:27)
      at Module._load (node:internal/modules/cjs/loader:1043:27)
      at Module.require (node:internal/modules/cjs/loader:1298:19)
      at require (node:internal/modules/helpers:182:18)
      at Object.<anonymous> (/home/runner/.npm/_npx/ba4f1959e38407b5/node_modules/firebase-tools/lib/dataconnect/schemaMigration.js:5:[25](https://github.com/.../actions/runs/13964637473/job/39092198105#step:12:28))
      at Module._compile (node:internal/modules/cjs/loader:1529:14) ***
    code: 'MODULE_NOT_FOUND',
    path: '/home/runner/.npm/_npx/ba4f1959e38407b5/node_modules/sql-formatter/package.json'
  ***

Expected behavior

Actual behavior

doum1004 avatar Mar 20 '25 08:03 doum1004

Same here and it only happens for the live deployment for some reason

Hades32 avatar Mar 20 '25 08:03 Hades32

@doum1004, @Hades32 , facing the same issue here. Most probably something went wrong with sql-formatter dependency of https://github.com/firebase/firebase-tools, so maybe, the actual issue should be raised there.

From what I saw in firebase-tools repo, the sql-formatter seems to have been introduced somewhere after version 13.7.0.

So, for now I've been able to fix the deployment by explicitly setting firebaseToolsVersion to 13.7.0 in my workflow yaml files.

Hope seeing it fixed soon.

olehrb1397 avatar Mar 20 '25 08:03 olehrb1397

Thanks for the workaround!

The weird thing is that the latest version of this action did work before, so I guess it's a dub-dependency version pinning issue

Hades32 avatar Mar 20 '25 08:03 Hades32

Same here it's only happening in deployment

dominhgiangbboy avatar Mar 20 '25 08:03 dominhgiangbboy

I could also reproduce it locally, when running the command via npx - npx firebase-tools@latest deploy

olehrb1397 avatar Mar 20 '25 08:03 olehrb1397

We also have this problem

tordsta avatar Mar 20 '25 09:03 tordsta

Hey, same on my side and it only happens for the live deployment for some reason

leszekkrol avatar Mar 20 '25 09:03 leszekkrol

related issues : https://github.com/firebase/firebase-tools/issues/8343

Nakira avatar Mar 20 '25 09:03 Nakira

Fix incoming https://github.com/sql-formatter-org/sql-formatter/pull/846

Nakira avatar Mar 20 '25 09:03 Nakira

Having the same problem

ThulinaWickramasinghe avatar Mar 20 '25 09:03 ThulinaWickramasinghe