[英]Serverless is failing when trying to initialize google cloud apis in node js
I am using google datastore for nodejs6.10 and it is working fine with serverless offline. 我正在将Google数据存储用于nodejs6.10,并且可以与无服务器脱机一起正常使用。 But when i deployed and tried to use the functions urls.
但是当我部署并尝试使用功能网址时。
I am getting following error: 我收到以下错误:
module initialization error: Error
at Error (native)
at Object.Module._extensions..node (module.js:597:18)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous>
(/var/task/node_modules/grpc/src/node/src/grpc_extension.js:38:15)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
I have tried installing npm packages and uploaded them but of no use. 我尝试安装npm软件包并上传了它们,但没有用。
Below is snapshot of my serverless provider section: 以下是我的无服务器提供程序部分的快照:
provider:
name: aws
runtime: nodejs6.10
environment:
Environment: ${env:Environment}
region: ${env:AWS_REGION}
This is how i am trying to use datastore: 这就是我尝试使用数据存储区的方式:
let datastore = require('@google-cloud/datastore')({
projectId: configFile[process.env.Environment].project,
keyFilename: configFile[process.env.Environment].keyfile
});
Can someone help me with this. 有人可以帮我弄这个吗。
Below code is what I see innode_modules/grpc/src/node/src/grpc_extension.js 下面的代码是我看到的innode_modules / grpc / src / node / src / grpc_extension.js
var binary = require('node-pre-gyp/lib/pre-binding');
var path = require('path');
var binding_path =
binary.find(path.resolve(path.join(__dirname, '../../../package.json')));
var binding = require(binding_path);
Had a look at the package.json for grpc and found few paths with local references. 查看了grpc的package.json,发现带有本地引用的路径很少。 Not sure if this is the issue, didn't try with corrections.
不知道这是否是问题,请不要尝试更正。 will try and update
会尝试更新
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.