Amazon ec2 谷歌翻译服务帐户403 dailylimited错误
我正在配置Node.JS服务器以使用Google Translate API。到目前为止,我已经做了以下工作:Amazon ec2 谷歌翻译服务帐户403 dailylimited错误,amazon-ec2,chef-infra,google-translate,google-api-nodejs-client,Amazon Ec2,Chef Infra,Google Translate,Google Api Nodejs Client,我正在配置Node.JS服务器以使用Google Translate API。到目前为止,我已经做了以下工作: 建立一个谷歌账户 添加信用卡并启用计费 创建项目 为项目启用Google Translate API 为project*创建两个服务帐户并保存JSON密钥文件 *一个用于本地开发的服务帐户和一个用于已部署应用程序的帐户 示例代码(Typescript): import * as Translate from '@google-cloud/translate'; export asyn
import * as Translate from '@google-cloud/translate';
export async function translate(text: string, to: string): Promise<string> {
let translation = '';
const googleTranslate = Translate({
projectId: PROJECT_ID,
keyFilename: PATH/TO/KEY_FILE
});
const response = await googleTranslate.translate(text, to);
if (Array.isArray(response[0])) {
for (let t of response[0]) {
translation += t;
}
}
else {
translation = response[0];
}
return translation;
}
{
domain: 'usageLimits',
reason: 'dailyLimitExceeded',
message: 'This API requires billing to be enabled on the project. Visit https://console.developers.google.com/billing?project=GOOGLE_PROJECT_ID to enable billing.',
extendedHelp: 'https://console.developers.google.com/billing?project=project=GOOGLE_PROJECT_ID'
}
计费已启用,那么我缺少什么?已解决
私钥中未被替换的角色正在一本厨师食谱中破译。现在,一个不同的进程会在初始化时将文件同步到服务器,这样翻译就可以工作了