firebase / firebase-functions

Firebase SDK for Cloud Functions
https://firebase.google.com/docs/functions/
MIT License
1.01k stars 201 forks source link

package.json validation breaks deploys for yarn workspace nohoist #1050

Open kristfal opened 2 years ago

kristfal commented 2 years ago

Related issues

[REQUIRED] Version info

node: v16.13.2 firebase-functions: 3.11.0 firebase-tools: 10.1.4 firebase-admin: 9.2.0

[REQUIRED] Test case

Add the following object to package.json

  "workspaces": {
    "nohoist": [
      "example-package-name"
    ]
  },
  "engines": {
    "node": "16"
  },

[REQUIRED] Steps to reproduce

Run firebase deploy

[REQUIRED] Expected behavior

Successful deployment

[REQUIRED] Actual behavior

Failed deployment

{
  "@type": "type.googleapis.com/google.cloud.audit.AuditLog",
  "status": {
    "code": 3,
    "message": "Build failed: npm ERR! code EWORKSPACESCONFIG\nnpm ERR! workspaces config expects an Array\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR!     /www-data-home/.npm/_logs/2022-03-01T15_39_30_803Z-debug.log; Error ID: b0ba1f57"
  },
  "authenticationInfo": {
    "principalEmail": "REDACTED"
  },
  "serviceName": "cloudfunctions.googleapis.com",
  "methodName": "google.cloud.functions.v1.CloudFunctionsService.UpdateFunction",
  "resourceName": "REDACTED"
}

Were you able to successfully deploy your functions?

Downgrading to node 14 or removing workspaces entry in package.json solves the issue.

Misc

The schema validation of package.json used to not allow objects. This has been resolved in a later version of schemastore.

See comment: https://github.com/microsoft/vscode/issues/77912#issuecomment-515391585

google-oss-bot commented 2 years ago

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

thomasdrouin commented 2 years ago

I have the same problem trying to update to Node 16 using firebase tools to deploy.

efstathiosntonas commented 2 years ago

same here, just upgraded to Node 16, tried to deploy a function using npm version 8.12.1

kristfal commented 1 year ago

This is still an issue with a relatively simple fix. Would love to see this fixed.

taeold commented 1 year ago

Taking a look. I think we may need to escalate this issue to Google Cloud Functions team.

efstathiosntonas commented 1 year ago

Hi, any news on this? We're still not able to deploy node 16 functions on monorepos. It's been 9 months since this issue has been introduced and it's an endless ping pong between google teams.

Muritavo commented 1 year ago

Is there a solution for this yet? We are having the same problem, and it looks like the fix is simple

efstathiosntonas commented 1 year ago

@Muritavo we switched to aws lambda because of this. Google lost a good amount of income from us. They don’t give a shit, we don’t give a shit. Simple as that.