-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error running with webpack: ENOENT: no such file or directory, open 'iam_service.json' #1246
Comments
@hgardneriv Thanks for the report! I think for now our take on webpack / rollup / et al is that we don't officially support it, but there is some talk about moving toward making it work at some point. We're putting the (badly named) |
@feywind is there any way to escalate this issue? We are running into this same issue would like to know if there is a path forward from GCP / Google. Thanks again! |
@amiracle The quickest way I know of to start some sort of escalation is through a support case, but I can say that there are actually some higher level discussions going on about the webpack support right now, so that might not be necessary. I can't promise anything, but it's more and more on the radar lately. |
@alexander-fenster is taking a look at this now, he's our gax maintainer, so hopefully he'll have something for you. |
Hi @hgardneriv, Judging by your stack, I'm assuming you run In this case, don't use the The problem is caused by this snippet in google-gax:
The default behavior of
Please let us know if this workaround is acceptable for you. |
To add to what I just said - since this code actually uses |
Adding one more thing :) This is my test project that worked for me: https://gist.github.com/alexander-fenster/33c0142f0d62c2d78d0fa3e76559e26b |
Hello @alexander-fenster thank you very much for the info. Yes, we are running webpack with 'target: "node"'. Unfortunately enabling __dirname will not work in this case, we use the following:
Something that would be nice is the ability to pass in the config directly vs. reading from the filesystem. With this option we could easily work around the issue. Given our webpack config, do you see any other viable work arounds? |
@hgardneriv OK, I'll try to see if I can make an option for proto files root and will get back to you. |
Also note that we have the same issue with protos.json which I think pulled is from @google-cloud/pubsub. |
Yes, those are very similar places in the code and the fix would affect all of them. The second place is in https://github.com/googleapis/nodejs-pubsub/blob/master/src/v1/publisher_client.ts#L156-L162 and the third is in https://github.com/googleapis/nodejs-pubsub/blob/master/src/v1/subscriber_client.ts#L157-L163. |
@hgardneriv Just an update - I actually found a better way to make it work; I'll basically replace loading the proto JSON from the filesystem with a |
@hgardneriv Before I start pushing the fix through several libraries, here's the test version for you to check:
The following command should give the pre-released versions for these two packages:
With these versions, I'm able to run the test code both with and without Thank you! |
@alexander-fenster - I'm happy to report that the build is working as expected, nice work!!! |
Thank you! I'll go ahead and push this changes to the generator and |
I have the same problem with google-translate. The dist version of the app (builded by webpack) always return @alexander-fenster any idea how to solve also this case? |
@alexander-fenster it looks like something similar to @hgardneriv case with @google-cloud/pubsub, but right now it's for translation. |
@dmarczydlo Translate library is generated by the same code generator so the fix will make it work too. Please wait a few days and this will go away when I update the generator and the dependency chain to use |
Awesome @alexander-fenster please let me know when the new approach will be available. I'm looking forward. |
@alexander-fenster any update? |
The code is ready, the releases are pending, please expect it soon. I'll update this issue. |
@dmarczydlo PR is sent (#1283). If you would like we can pre-release it for you, or you can wait till Monday when we can make an official release. Thank you for waiting, and thank you for asking this question! I believe the code is much less fragile now that we use the regular |
@alexander-fenster will be great to test |
@dmarczydlo Sure, |
@dmarczydlo This is not the right place to talk about the translate library, but just wanted to let you know that it just got released (v6.2.1). In case if you see any issue with it, please create an issue in its own repo. Thank you! |
This is pending this release PR: |
Environment details
@google-cloud/pubsub
version: 2.10.0Steps to reproduce
"err":{"message":"ENOENT: no such file or directory, open 'iam_service.json'"," stack":"Error: ENOENT: no such file or directory, open 'iam_service.json'\n at Object.openSync (fs.js:476:3)\n at Object.readFileSync (fs.js:377:35)\n at fetch (/Users/harrygardner/Documents/code/cribl/dist/sluice/bin/cribl.bundle.js:403345:34) at Root.load (/Users/harrygardner/Documents/code/cribl/dist/sluice/bin/cribl.bundle.js:403379:13) at Root.loadSync (/Users/harrygardner/Documents/code/cribl/dist/sluice/bin/cribl.bundle.js:403420:17) at Object.loadSync (/Users/harrygardner/Documents/code/cribl/dist/sluice/bin/cribl.bundle.js:105027:29) at GrpcClient.loadFromProto (/Users/harrygardner/Documents/code/cribl/dist/sluice/bin/cribl.bundle.js:245393:48) at GrpcClient.loadProto (/Users/harrygardner/Documents/code/cribl/dist/sluice/bin/cribl.bundle.js:245434:21) at new IamClient (/Users/harrygardner/Documents/code/cribl/dist/sluice/bin/cribl.bundle.js:245684:38) at new SubscriberClient (/Users/harrygardner/Documents/code/cribl/dist/sluice/bin/cribl.bundle.js:86374:26)"
NOTE: This issue only happens when running with webpack, it works expected when webpack is not in use.
$ ls ../../protos
iam_service.json
protos.json
Unfortunately ../../protos falls one level up of our install directory, so it's not a valid work around.
`"fetch is not a function","stack":"TypeError: fetch is not a function
at Service.newServiceStub. [as testIamPermissions] (/Users/harrygardner/Documents/code/cribl/dist/sluice/bin/cribl.bundle.js:244522:17)
at /Users/harrygardner/Documents/code/cribl/dist/sluice/bin/cribl.bundle.js:245730:29
at /Users/harrygardner/Documents/code/cribl/dist/sluice/bin/cribl.bundle.js:246661:16
at OngoingCall.call (/Users/harrygardner/Documents/code/cribl/dist/sluice/bin/cribl.bundle.js:244030:27)
at NormalApiCaller.call (/Users/harrygardner/Documents/code/cribl/dist/sluice/bin/cribl.bundle.js:246452:19)
at /Users/harrygardner/Documents/code/cribl/dist/sluice/bin/cribl.bundle.js:244163:30\n at processTicksAndRejections (internal/process/task_queues.js:93:5)
Is there a work around for this issue?
The text was updated successfully, but these errors were encountered: