Skip to content

(Reopen PLEASE) Missing dependency request causes an error when using Google Cloud's Vision API #353

@tferrerm

Description

@tferrerm

Environment details

  • OS: Ubuntu 20.04 x64
  • Node.js version: v14.2.0
  • npm version: 7.24.1
  • google-gax version: 2.28.0

Steps to reproduce

  1. Create a serverless Node.js project
  2. Add the serverless-webpack plugin to your serverless.yml file and use webpack with babel to package the function that will be created
  3. Add @google-cloud/vision as a dependency
  4. Create a Node.js Google Function or AWS Lambda that makes use of the Google Vision API (e.g. do something similar to what is shown in this SafeSearch example)
  5. Attempt to build the lambda with webpack

Error

WARNING in ./node_modules/retry-request/index.js 74:21-39
Module not found: Error: Can't resolve 'request' in '/home/user/project/node_modules/retry-request'
 @ ./node_modules/@google-cloud/vision/node_modules/google-gax/build/src/streamingCalls/streaming.js 22:21-45
 @ ./node_modules/@google-cloud/vision/node_modules/google-gax/build/src/index.js 64:18-55
 @ ./node_modules/@google-cloud/vision/build/src/helpers.js 24:12-33
 @ ./node_modules/@google-cloud/vision/build/src/index.js 31:16-36
 @ ./src/image-service/handler/lambdaGcloudWorker.js 38:15-46

Possible solution

Add the package request as a dependency of the project here given you've included retry-request

Workaround

Add request as a dependency of the serverless project by running npm install request --save

Metadata

Metadata

Assignees

Labels

status: will not fixInvalid (untrue/unsound/erroneous), inconsistent with product, not on roadmap.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions