-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Labels
type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.
Description
- Is this a client library issue or a product issue?
This is occurring when bundling @google-cloud/pubsub, however the underlying issue is with this library.
- Did someone already solve this?
Not that I can see.
- Do you have a support contract?
No.
Environment details
- OS: Linux
- Node.js version: v12.14.1
- npm version: v6.14.8
google-gaxversion: google-gax@2.10.0
Steps to reproduce
Edit: A minimal reproduction has been provided at https://github.com/elyobo/gax-node-948-repo, original notes below.
- Use webpack to bundle an application using
@google-cloud/pubsub - Run the application, such that it attempts to publish to a PubSub topic
- The attempt to publish fails with an error as follows
Error: ENOENT: no such file or directory, open 'iam_service.json'
at Object.openSync (fs.js:462:3)
at Object.readFileSync (fs.js:364:35)
at f (/srv/www/app/webpack:/node_modules/protobufjs/src/root.js:172:34)
at p.e [as load] (/srv/www/app/webpack:/node_modules/protobufjs/src/root.js:206:13)
at p.loadSync (/srv/www/app/webpack:/node_modules/protobufjs/src/root.js:247:17)
at Object.t.loadSync (/srv/www/app/webpack:/node_modules/@grpc/proto-loader/build/src/index.js:223:29)
at t.GrpcClient.loadFromProto (/srv/www/app/webpack:/src/grpc.ts:145:40)
at t.GrpcClient.loadProto (/srv/www/app/webpack:/src/grpc.ts:179:17)
at new t.IamClient (/srv/www/app/webpack:/src/iamService.ts:101:34)
at new t.PublisherClient (/srv/www/app/webpack:/src/v1/publisher_client.ts:137:22)
at m.getClientAsync_ (/srv/www/app/webpack:/src/pubsub.ts:1068:19)
at m.getClient_ (/srv/www/app/webpack:/src/pubsub.ts:1031:10)
at m.request (/srv/www/app/webpack:/src/pubsub.ts:1117:10)
at t.Queue._publish (/srv/www/app/webpack:/src/publisher/message-queues.ts:78:11)
at t.Queue.publish (/srv/www/app/webpack:/src/publisher/message-queues.ts:144:10)
at Timeout.<anonymous> (/srv/www/app/webpack:/src/publisher/message-queues.ts:128:44)
The underlying issue appears to be in iamService.ts, where a path to the iam_service.json is passed down that the application tries to load later. The path is correct in un-bundled code, but is incorrect in bundled code and so loading fails at runtime.
Is this meant to work? Is there a known workaround for the problem?
Thanks for any assistance.
CC: @alexander-fenster @xiaozhenliu-gg5 as authors of the iamService.ts.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.