我使用 React 成功地将我的代码部署到 AWS Amplify,并且可以通过为环境提供的 URL 访问应用程序。但是,当我启动 API 调用时,什么也没有发生。
ERROR Uncaught Exception {"errorType":"TypeError","errorMessage":"Cannot read property 'link_token' of undefined","stack":["TypeError: Cannot read property 'link_token' of undefined"," at /var/task/app.js:44:46"," at Immediate.<anonymous> (/var/task/node_modules/plaid/lib/wrapPromise.js:29:9)"," at processImmediate (internal/timers.js:461:21)"]}
我检查了 AWS 中的配置,可以看到分别在 Lambda、Dynamo 和 API Gateway 中创建的函数、存储和 API。但是,当我在 Amplify 中打开我的应用程序时,我没有看到创建的存储或 API。函数已创建。有没有什么东西可以导致函数被创建但存储和 API 不被创建?后端 JSON 配置(如下)包含我所期望的所有五个。
放大 backend-config.json
{
"function": {
"linktokenfunction": {
"build": true,
"providerPlugin": "awscloudformation",
"service": "Lambda"
},
"onsuccessfunction": {
"build": true,
"providerPlugin": "awscloudformation",
"service": "Lambda",
"dependsOn": [
{
"category": "storage",
"resourceName": "tutorialdb",
"attributes": [
"Name",
"Arn"
]
}
]
}
},
"api": {
"linktokenapi": {
"service": "API Gateway",
"providerPlugin": "awscloudformation",
"dependsOn": [
{
"category": "function",
"resourceName": "linktokenfunction",
"attributes": [
"Name",
"Arn"
]
}
]
},
"onsuccessapi": {
"service": "API Gateway",
"providerPlugin": "awscloudformation",
"dependsOn": [
{
"category": "function",
"resourceName": "onsuccessfunction",
"attributes": [
"Name",
"Arn"
]
}
]
}
},
"storage": {
"tutorialdb": {
"service": "DynamoDB",
"providerPlugin": "awscloudformation"
}
}
}