amplify-backend icon indicating copy to clipboard operation
amplify-backend copied to clipboard

Amplify Custom Headers Monorepo format not supported

Open hackmajoris opened this issue 1 year ago • 3 comments

How did you install the Amplify CLI?

pnpm

If applicable, what version of Node.js are you using?

18+

Amplify CLI Version

11.0.5

What operating system are you using?

macOS

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No

Describe the bug

The custom headers format for monorepo is not recognised.

Expected behavior

The custom headers format for monorepo is recognised.

Reproduction steps

  1. Go to Amplify Console
  2. Select the Application/Hosting/Custom Headers
  3. Try to use the Monorepo format as shown in the example: https://docs.aws.amazon.com/amplify/latest/userguide/custom-headers.html#custom-header-YAML-format ex:
applications:
  - appRoot: 'dfd'
    customHeaders:
      - pattern: '**'
        headers:
          - key: 'Strict-Transport-Security'
            value: 'max-age=31536000; includeSubDomains'
          - key: 'X-Frame-Options'
            value: 'SAMEORIGIN'
          - key: 'X-XSS-Protection'
            value: '1; mode=block'
          - key: 'X-Content-Type-Options'
            value: 'nosniff'
          - key: 'Content-Security-Policy'
            value: "default-src 'self'"

The result:

image

Project Identifier

No response

Log output

# Put your logs below this line


Additional information

No response

Before submitting, please confirm:

  • [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • [X] I have removed any sensitive information from my code snippets and submission.

hackmajoris avatar May 21 '24 09:05 hackmajoris

This origins from Amplify Console new UI changes.

In the old UI, the format was recognised and it showed a correct YAML format. There is a customHttp.yml at the root of the project with the values

Now, it looks like this(notice that no changes were made): image

You're making customers to lose money. Please do something.

hackmajoris avatar May 21 '24 09:05 hackmajoris

On a quick test, I was able to reproduce the issue. Marking as bug.

created the header as nested throws an error: image (22)

creating it without nested does not throw an error. image (21)

The docs show as nested: https://docs.aws.amazon.com/amplify/latest/userguide/custom-headers.html#custom-header-YAML-format

On a save the console throws an error:

image

ykethan avatar May 21 '24 15:05 ykethan

@hackmajoris we are prioritizing a fix for this issue. In the meantime can you DM me or @Jay2113 on Discord to discuss this?

swaminator avatar May 22 '24 10:05 swaminator

@hackmajoris thank you for your continued cooperation. We have deployed a fix for this issue and can you please verify if you are now unblocked?

Jay2113 avatar May 29 '24 03:05 Jay2113

@hackmajoris thank you for your continued cooperation. We have deployed a fix for this issue and can you please verify if you are now unblocked?

I did some tests and the issue is gone. Thanks for your effort to fix it. I'll close the issue.

hackmajoris avatar May 29 '24 07:05 hackmajoris