serverless / serverless-google-cloudfunctions

Serverless Google Cloud Functions Plugin – Adds Google Cloud Functions support to the Serverless Framework
https://www.serverless.com
MIT License
272 stars 127 forks source link

GCP Deployment Manager is running yarn again (instead of using packaged file from Serverless) #263

Open Lusitaniae opened 3 years ago

Lusitaniae commented 3 years ago

I'm deploying two functions from my CI/CD pipeline

One in AWS, one in GCP

Both of them are pulling repos from our private Gitlab besides all the other public dependencies from npm.

It seems that after serverless packages and uploads the packge to Google Cloud, GCP Deployment Manager is running Yarn again and failing at the yarn step because it's unable to authenticate to our private repos?

Is that expected?

I'd expect a consistent behavior with AWS deployments but GCP stands out?

Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Compiling function "gcp-function-test"...
Serverless: Uploading artifacts...
Serverless: Artifacts successfully uploaded...
Serverless: Updating deployment...
Serverless: Checking deployment update progress...
................ 
  Error --------------------------------------------------

  Error: Deployment failed: RESOURCE_ERROR

       {"ResourceType":"gcp-types/cloudfunctions-v1:projects.locations.functions","ResourceErrorCode":"400","ResourceErrorMessage":"Build failed: yarn install v1.22.4\n[1/4] Resolving packages...\n[2/4] Fetching packages...\nerror Command failed.\nExit code: 128\nCommand: git\nArguments: ls-remote --tags --heads git@gitlab.com:my-team/my-project-1\nDirectory: /workspace\nOutput:\nHost key verification failed.\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\ninfo Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.; Error ID: 98e389b6"}
      at throwErrorIfDeploymentFails (/home/user/workspace/org/app/app1/node_modules/serverless-google-cloudfunctions/shared/monitorDeployment.js:71:11)
      at /home/user/workspace/org/app/app1/node_modules/serverless-google-cloudfunctions/shared/monitorDeployment.js:42:17
      at processTicksAndRejections (internal/process/task_queues.js:97:5)

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     Operating System:          linux
     Node Version:              14.4.0
     Framework Version:         2.1.1 (standalone)
     Plugin Version:            4.0.4
     SDK Version:               2.3.2
     Components Version:        3.1.3
cat package.json 
{
  "name": "app1",
  "version": "1.0.0",
  "description": "",
  "main": "src/index.js",
  "author": "",
  "license": "ISC",
  "dependencies": {
    "app": "git+ssh://git@gitlab.com:my-team/my-project#branch-name"
  }
}
Lusitaniae commented 3 years ago

Including deployment tokens in package.json works around the problem, but it would be preferred not do it that way.

pgrzesik commented 3 years ago

Hello @Lusitaniae - I'm going to move this issue to Google plugin repository as it seems more fitting there. Also, please include reproducible steps and sample serverless.yml - it will help diagnosing the problem