zoukankan      html  css  js  c++  java
  • amplify踩坑之旅

    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:wwwFCpointpamplify#current-cloud-backendfunctionfcpointp5199be52

    解决:

    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" } }
    ]
    },...
    ]
     注意红色字,一定要对应表名


  • 相关阅读:
    win10 UWP button
    内网分享资源
    内网分享资源
    CF724F Uniformly Branched Trees
    win10 UWP FlipView
    win10 UWP FlipView
    win10 UWP FlipView
    搭建阿里云 centos mysql tomcat jdk
    搭建阿里云 centos mysql tomcat jdk
    win10 UWP 申请微软开发者
  • 原文地址:https://www.cnblogs.com/caicaizi/p/14122404.html
Copyright © 2011-2022 走看看