amplify mockで「Cyclic dependency detected in the Resources」が発生して困っている(一時的な回避策あり)

目次

環境

OS:mac
amplify-cli:11.0.2

amplify mockを実行したら、以下のようなエラーでmock serverが動かない。

Failed to start API Mocking. Running cleanup tasks.
MockProcessFault: Failed to start API Mocking.. Reason: Cyclic dependency detected in the Resources
    at APITest.start (/snapshot/repo/build/node_modules/@aws-amplify/amplify-util-mock/lib/api/api.js:157:13)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async start (/snapshot/repo/build/node_modules/@aws-amplify/amplify-util-mock/lib/api/index.js:18:5)
    at async Promise.all (index 0)
    at async mockAllCategories (/snapshot/repo/build/node_modules/@aws-amplify/amplify-util-mock/lib/mockAll.js:48:5)
    at async Object.run (/snapshot/repo/build/node_modules/@aws-amplify/amplify-util-mock/lib/commands/mock/mock.js:19:3)
    at async Object.executeAmplifyCommand (/snapshot/repo/build/node_modules/@aws-amplify/amplify-util-mock/lib/amplify-plugin-index.js:55:3)
    at async executePluginModuleCommand (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:135:5)
    at async executeCommand (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:33:9)
    at async Object.run (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/index.js:117:5) {
  classification: 'FAULT',
  options: {
    message: 'Failed to start API Mocking.. Reason: Cyclic dependency detected in the Resources',
    link: 'https://docs.amplify.aws/cli/graphql/troubleshooting/'
  },
  downstreamException: undefined,
  toObject: [Function (anonymous)],
  details: undefined,
  resolution: undefined,
  code: undefined,
  link: 'https://docs.amplify.aws/cli/graphql/troubleshooting/'
}

googleで調べても特に情報なし。

schema.graphqlにて、9つ以上のtypeを定義するとこのエラーが発生する。

8つ以下にするとmock serverは立ち上がる。

なぜかtypeの定義数が影響している模様。

mockするときは、一時的にtype宣言を減らして実行するしか無さそう。

amplify-cliのバグっぽい?

んー、めんどくさい。