Skip to content

Local dependencies prevent the google cloud function from building #276

Open

Description

@HariShyamU

Issue description
I'm trying to implement code sharing between multiple services by using npm local dependencies. Here is the code structure:

endpoints
-servicename
--package.json
--serverless.yml

libs
-database.js
-auth.js
-package.json

I've added the libs folder as a local dependency to my function like so:

"dependencies": { "libs": "../../libs" }

When the cloud build is initiated for deployment, I get an error shown below during deployment:

Build failed: npm ERR! code EEXIST
npm ERR! syscall mkdir
npm ERR! path /workspace/node_modules/libs
npm ERR! errno -17
npm ERR! EEXIST: file already exists, mkdir '/workspace/node_modules/libs'
npm ERR! File exists: /workspace/node_modules/libs
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

Service configuration (serverless.yml) content

service: servicename

provider:
  name: google
  stage: dev
  runtime: nodejs14
  region: asia-south1
  project: project-name
  credentials: "../../creds.json"

frameworkVersion: '2'

plugins:
  - serverless-google-cloudfunctions

package:
  exclude:
    - node_modules/**
    - .gitignore
    - .git/**

functions:
  get:
    handler: servicehandler
    events:
      - http: path

Command name and used flags
serverless deploy --region asia-south1

Environment information
Framework Core: 2.59.0
Plugin: 5.4.4
SDK: 4.3.0
Components: 3.17.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions