2
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?

More than 1 year has passed since last update.

モノレポなリポジトリにAmplify Hostingでカスタムヘッダーの設定をしたらビルドできなくなった

Last updated at Posted at 2023-01-17

はじめに

こんにちは。Amplify(旧 Amplify Console)が大好きです。
モノレポでフロントのデプロイと配信を行っていましたが、ある時から

Monorepo spec provided without "applications" key

というエラーになってしまいました。
ググったところ直近で設定したカスタムヘッダーの影響があるようです。

I noticed you are using customHttp.yml. Can you also try to add applications and appRoot by following this instruction: https://docs.aws.amazon.com/amplify/latest/userguide/custom-headers.html#custom-header-YAML-format ? thanks

GitHubのIssueでは customHttp.yml で設定するように求められていますが、直近で設定したカスタムヘッダーはマネジメントコンソールで設定しているため、実質的なYamlファイルはありません。

ただマネジメントコンソールで設定できる内容がほぼ同一なため、こちらに手を加えていきます。

customHttp.yml
customHeaders:
  - pattern: '**'
    headers:
      - key: X-Frame-Options
        value: SAMEORIGIN

公式サイトによるとモノレポの場合には全体にapplicationを追加した上でappRootでアプリを切り分け、モノレポのファイル場所の記述を行うようです。

customHttp.yml
applications:
  - appRoot: front
    customHeaders:
    - pattern: '**/*'
      headers:
      - key: X-Frame-Options
        value: SAMEORIGIN

上記で正しくビルドができるようになりました。

2
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
2
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?