0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

AWS AppSync+Amplifyを使用したときに苦労したこと

Posted at

IONICでDynamoDBからデータを取得して表示するプログラムを書いていて
初めてAppSync+Amplifyを用いたときに苦労したことを備忘として書いておく

1.プロキシ環境でAmplify/Cliを実行しようとすると通信エラーとなる
 AppSyncにスキーマを定義した後にAmplify/Cliでcodegenしようとすると以下のエラーが出た

Downloading release from https://package.cli.amplify.aws/14.0.0/amplify-pkg-win-x64.tgz
Error fetching release: Request failed with status code 400

 調べるとAmplify/Cliは環境変数HTTPS_PROXYを見てくれると書いてあったが、どうも見てくれていないようだ。

 解決法としては上記の https://package.cli.amplify.aws/14.0.0/amplify-pkg-win-x64.tgz にアクセスしてamplify-pkg-win-x64.tgzをダウンロードして解凍する。それで得られるamplify-pkg-win-x64.exeを用いてcodegenするとコードが生成される。

2.生成したAPI.service.tsでビルドエラーが出る
 ようやく生成できたコードを使ってビルドを行うと以下のエラーが表示される

TS2321: Excessive stack depth comparing types 'Prettify<DeepReadOnlyObject<RestoreArrays<UnionToIntersection<DeepPickFromPath<FlatModel, ?[number]>>, FlatModel>>>' and 'Prettify<DeepReadOnlyObject<RestoreArrays<UnionToIntersection<DeepPickFromPath<FlatModel, ?[number]>>, FlatModel>>>'. [plugin angular-compiler]
src/app/API.service.ts:728:18:
     728 │     this.client = generateClient();

 生成されたコードの中で型の指定がおかしいようだ。生成されたコードはできる限り触りたくないが、仕方ないので以下のように修正

constructor() {
   this.client = generateClient();
}

 constructor() {
    this.client = generateClient() as any;
 }

にする。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?