1,DataStore does not support 1 to 1 connection with both sides of connection as optional field: Album.attraction
There was an error pushing the API resource
Error: DataStore does not support 1 to 1 connection with both sides of connection as optional field: Album.attraction
解决:attraction: Attraction! @connection(name: "AttractionAlbums", fields:["AttractionID"], sortField: "createdAt") #加个!号
2, One or more parameter values were invalid: Index KeySchema does not have a range key for index: byCourse
设置表关系一对多
解决:将二级索引byCourse删除,从表设置主索引@key(fields: ["courseID","sort"])
3,Attempting to edit the key schema of the AttractionTable table in the Attraction stack.
Cause: Adding a primary @key directive to an existing @model.
How to fix: Remove the @key directive or provide a name e.g @key(name: "ByStatus", fields: ["status"]).
解决:继上面2,设置主索引的主键为id时报的错,改为CourseID
4,amplify Following resources failed 或amplify Missing required key 'apiId' in params 。。。。。
终极处理:
1,amplify delete
2,npm cache clean -f
3,amplify configure
4,amplify init
接下来一个个重新add ,push update
4,这个最难搞
Attempting to edit the global secondary index byAttraction on the AlbumTable table in the Album stack.
There was an error pushing the API resource
Attempting to edit the global secondary index byAttraction on the AlbumTable table in the Album stack.
Cause: The key schema of a global secondary index cannot be changed after being deployed.
How to fix: If using @key, first add a new @key, run `amplify push`, and then remove the old @key. If using @connection,
first remove the @connection, run `amplify push`, and then add the new @connection with the new configuration.
解决:remove重新add,push
5,设置数据表排序必须通过@key创建二级索引queryField=另外建立一个查询语句 #@key(name: "sort", fields: ["partition","level"], queryField: "soryByLevel")
6,key设置冲突有时不能通gql-compile检查出,要push才知道
7,push到一半取消会有风险,导致数据库不能重建
8,当项目文件移到新的设备,ampflfy push时会报以下错误
- Fetching updates to backend environment: dev from the cloud.Could not initialize 'dev': The "path" argument must be of
type string. Received an instance of Error
解决:重新 amplify configure project
9,当push失败后,再push会报找不到文件Error: ENOENT: no such file or directory, stat 'C:\www\FCpointp\amplify\#current-cloud-backend\function\fcpointp5199be52
解决:
I did the following and it resolved my issues.
Follow the instructions here and call amplify hosting add.
Then move the api and auth folders and their content from the backend folder to the #current-cloud-backend folder.
Then run amplify push.
但我是用 amplify env checkout devone 再 push 解决的 ##devone 是环境名
10,经过不懈努力,解决lambda无法更新数据库问题,对比demo发现创建数据库时缺少 以下内容
@auth(rules: [{ allow: owner }##原有,
{ allow: private, provider: iam, operations: [ read, update ] }##缺少部分])
11,dynomaDB 导数据流程
利用data pipeline 服务
先从dynomaDB导入出一条假数据到S3,然后把要导的数据填入导出来的模板文件中,再从S3中选择前面导出数据的文件夹,而不是选择模板文件。
12,vue打包后bootstrap的样式不生效的原因是demo中引入了tailwind.css,应将其与
tailwind.config.js
一并删除
13.appsync使用transactWriteItems事务操作,因自定义解析器需要操作多个表,创建资源同时必须创建角色和数据源,利用cloudformation创建角色时总是报错,是因为教程中CustomResources.json的写法还是旧式:
"Resource": "
arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/Album/updateAlbum”
新式的写法是:
"Resource": [
{
"Fn::Sub": [
"arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/Album-kdpc7szarvgwfiabjb2apn66ey-dev
/updateAlbum",
{ "env": { "Ref": "env" } }
]
},...
]
注意红色字,一定要对应表名
14.在我自定义的resolver中$util.autoId() 不生效,报variable 'Point' has coerced Null value for NonNull type 'ID!
原因:在自定义的resource.json中创建数据源时指向空表,无id项目,所有$util.autoId()生成null
15.前端设置取消页面自动翻译 https://office-obata.com/report/memorandum/post-3758/