-
Notifications
You must be signed in to change notification settings - Fork 99
Unable to run with webpack #344
Comments
if I copy a protobuf folder like this: The path is unresolvable even if I copy a 'protos' folder. |
Hey @ipryshlyak, with a few tweaks, it should be possible to run any of our Let me know if you bump into any issues. |
@bcoe the problem is that it fails on 'require'/'import' statement before I can call a constructor with a fallback option. `// Load Google's well-known proto files that aren't exposed by Protobuf.js.
}` Here's my code:
|
@ipryshlyak Unfortunately, our dependencies (gRPC and protobuf modules) are not webpackable (they use https://github.com/googleapis/nodejs-language/blob/master/webpack.config.js#L41-L60 In a fallback mode, those dependencies are not used so it will work. You have two options:
and then in your HTML code:
In both cases, make sure you pass an It works, but since we haven't properly documented this yet, we don't officially support it - you can try it and let us know if it helped! |
Thank you for filing this issue. We proposed a workaround for you a while ago but haven't heard back. Please feel free to re-open this issue with more information. |
I'm trying to develop an aws lambda function which calls a language api.
The code is the bootstrap example.
Lambda Error: ENOENT: no such file or directory, open 'node_modules/protobufjs/google/protobuf/api.proto' ; stack: Error: ENOENT: no such file or directory, open 'node_modules/protobufjs/google/protobuf/api.proto' at Object.openSync (fs.js:440:3) at Object.readFileSync (fs.js:342:35) at fetch (/Users/ihorpryshliak/Desktop/Workspace/rForgeProject/rforge/packages/analyzerService/.webpack/service/analyzer/webpack:/node_modules/protobufjs/src/root.js:160:1) at Root.load (/Users/ihorpryshliak/Desktop/Workspace/rForgeProject/rforge/packages/analyzerService/.webpack/service/analyzer/webpack:/node_modules/protobufjs/src/root.js:194:1) at Root.loadSync (/Users/ihorpryshliak/Desktop/Workspace/rForgeProject/rforge/packages/analyzerService/.webpack/service/analyzer/webpack:/node_modules/protobufjs/src/root.js:235:1) at Object.loadSync (/Users/ihorpryshliak/Desktop/Workspace/rForgeProject/rforge/packages/analyzerService/.webpack/service/analyzer/webpack:/node_modules/protobufjs/src/index-light.js:69:1) at Object../node_modules/@grpc/proto-loader/build/src/index.js (/Users/ihorpryshliak/Desktop/Workspace/rForgeProject/rforge/packages/analyzerService/.webpack/service/analyzer/webpack:/node_modules/@grpc/proto-loader/build/src/index.js:235:1) at __webpack_require__ (/Users/ihorpryshliak/Desktop/Workspace/rForgeProject/rforge/packages/analyzerService/.webpack/service/analyzer/webpack:/webpack/bootstrap:19:1) at Object.<anonymous> (/Users/ihorpryshliak/Desktop/Workspace/rForgeProject/rforge/packages/analyzerService/.webpack/service/analyzer/webpack:/node_modules/google-gax/build/src/grpc.js:34:25) at Object../node_modules/google-gax/build/src/grpc.js (/Users/ihorpryshliak/Desktop/Workspace/rForgeProject/rforge/packages/analyzerService/.webpack/service/analyzer/analyze.js:55452:30) at __webpack_require__ (/Users/ihorpryshliak/Desktop/Workspace/rForgeProject/rforge/packages/analyzerService/.webpack/service/analyzer/webpack:/webpack/bootstrap:19:1) at Object../node_modules/google-gax/build/src/index.js (/Users/ihorpryshliak/Desktop/Workspace/rForgeProject/rforge/packages/analyzerService/.webpack/service/analyzer/webpack:/node_modules/google-gax/build/src/index.js:33:16) at __webpack_require__ (/Users/ihorpryshliak/Desktop/Workspace/rForgeProject/rforge/packages/analyzerService/.webpack/service/analyzer/webpack:/webpack/bootstrap:19:1) at Object.<anonymous> (/Users/ihorpryshliak/Desktop/Workspace/rForgeProject/rforge/packages/analyzerService/.webpack/service/analyzer/webpack:/node_modules/@google-cloud/language/src/v1/language_service_client.js:18:13) at Object../node_modules/@google-cloud/language/src/v1/language_service_client.js (/Users/ihorpryshliak/Desktop/Workspace/rForgeProject/rforge/packages/analyzerService/.webpack/service/analyzer/analyze.js:34096:30) at __webpack_require__ (/Users/ihorpryshliak/Desktop/Workspace/rForgeProject/rforge/packages/analyzerService/.webpack/service/analyzer/webpack:/webpack/bootstrap:19:1) at Object../node_modules/@google-cloud/language/src/v1/index.js (/Users/ihorpryshliak/Desktop/Workspace/rForgeProject/rforge/packages/analyzerService/.webpack/service/analyzer/webpack:/node_modules/@google-cloud/language/src/v1/index.js:17:31) at __webpack_require__ (/Users/ihorpryshliak/Desktop/Workspace/rForgeProject/rforge/packages/analyzerService/.webpack/service/analyzer/webpack:/webpack/bootstrap:19:1) at Object../node_modules/@google-cloud/language/src/index.js (/Users/ihorpryshliak/Desktop/Workspace/rForgeProject/rforge/packages/analyzerService/.webpack/service/analyzer/webpack:/node_modules/@google-cloud/language/src/index.js:35:7) at __webpack_require__ (/Users/ihorpryshliak/Desktop/Workspace/rForgeProject/rforge/packages/analyzerService/.webpack/service/analyzer/webpack:/webpack/bootstrap:19:1) at main (/Users/ihorpryshliak/Desktop/Workspace/rForgeProject/rforge/packages/analyzerService/.webpack/service/analyzer/webpack:/analyzer/analyze.ts:11:22) at /Users/ihorpryshliak/.nvm/versions/node/v12.13.1/lib/node_modules/serverless/lib/plugins/aws/invokeLocal/index.js:710:30 at Promise._execute (/Users/ihorpryshliak/.nvm/versions/node/v12.13.1/lib/node_modules/serverless/node_modules/bluebird/js/release/debuggability.js:384:9) at Promise._resolveFromExecutor (/Users/ihorpryshliak/.nvm/versions/node/v12.13.1/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:518:18) at new Promise (/Users/ihorpryshliak/.nvm/versions/node/v12.13.1/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:103:10) at AwsInvokeLocal.invokeLocalNodeJs (/Users/ihorpryshliak/.nvm/versions/node/v12.13.1/lib/node_modules/serverless/lib/plugins/aws/invokeLocal/index.js:663:12) at AwsInvokeLocal.invokeLocal (/Users/ihorpryshliak/.nvm/versions/node/v12.13.1/lib/node_modules/serverless/lib/plugins/aws/invokeLocal/index.js:169:19) at AwsInvokeLocal.tryCatcher (/Users/ihorpryshliak/.nvm/versions/node/v12.13.1/lib/node_modules/serverless/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/Users/ihorpryshliak/.nvm/versions/node/v12.13.1/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:547:31) at Promise._settlePromise (/Users/ihorpryshliak/.nvm/versions/node/v12.13.1/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:604:18) at Promise._settlePromiseCtx (/Users/ihorpryshliak/.nvm/versions/node/v12.13.1/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:641:10) at _drainQueueStep (/Users/ihorpryshliak/.nvm/versions/node/v12.13.1/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:97:12) at _drainQueue (/Users/ihorpryshliak/.nvm/versions/node/v12.13.1/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:86:9) at Async._drainQueues (/Users/ihorpryshliak/.nvm/versions/node/v12.13.1/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:102:5) at Immediate.Async.drainQueues [as _onImmediate] (/Users/ihorpryshliak/.nvm/versions/node/v12.13.1/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:15:14) at processImmediate (internal/timers.js:439:21) at process.topLevelDomainCallback (domain.js:130:23)
It looks like webpack doesn't know how to deal with protos.
Maybe, there is already a solution for this? Is it even possible to use google/language api with aws lambda via serverless framework?
The text was updated successfully, but these errors were encountered: