简体   繁体   English

尝试在Node JS中初始化Google Cloud API时Serverless失败

[英]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.

相关问题 尝试使用Google API Node.js客户端时出现“找不到模块”错误 - Getting “Module not found” error when trying to use the Google APIs Node.js client Node.js中的Google API - Google APIs in Node.js 尝试在node.js中使用google云功能时,admin.firestore不是一个功能 - admin.firestore is not a function when trying to use google cloud functions with node.js 将简单的 node.js 应用程序部署到 AWS Lambda 无服务器失败并出现 GeneralServiceException - Deployment of simple node js application to AWS Lambda Serverless Failing with GeneralServiceException 尝试使用事件驱动的 Google Cloud Functions Node JS 10 计算特定目录中的文件数时出错 - Error when trying to count number of files in a specific directory using event driven Google Cloud Functions Node JS 10 使用 google apis node.js 客户端插入 Google 任务时标题为空 - Empty title when inserting a Google Task with google apis node.js client 无法使用google-cloud node.js客户端插入BigQuery - Failing to insert into BigQuery using google-cloud node.js client 在 node.js 中将文件上传到 Google Cloud Storage 时出错 - Error when uploading file to Google Cloud Storage in node.js Node js中的Google Cloud Messaging - Google Cloud Messaging in Node js 尝试使用 node.js 编写 Google Cloud Function 以写入 Google 表格 - Trying to write Google Cloud Function to write to a Google Sheet using node.js
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM