aws-amplify / amplify-hosting

AWS Amplify Hosting provides a Git-based workflow for deploying and hosting fullstack serverless web applications.
https://aws.amazon.com/amplify/hosting/
Apache License 2.0
456 stars 115 forks source link

Build error: Unable to parse build spec: bad indentation of a mapping entry #3170

Closed calnastic0 closed 1 year ago

calnastic0 commented 1 year ago

Before opening, please confirm:

App Id

d1d4m4xrhdcqdv

AWS Region

us-east-1

Amplify Hosting feature

Not Applicable

Describe the bug

For the app:

The following policies were attached to the service role:

"Reconnect repository" button was clicked and code branch was confirmed.

The build setting amplify.yml is copied from this article. I'm also pasting it below in the build setting box.

Expected behavior

Be able to build and deploy

Reproduction steps

  1. In AWS Amplify console, go to our app
  2. Trigger a build from master
  3. Build fails as it cannot read the amplify.yml

Build Settings

version: 1
frontend:
  phases: null
  preBuild: null
  commands:
    - 'curl -sSL https://dot.net/v1/dotnet-install.sh > dotnet-install.sh'
    - chmod +x *.sh
    - ./dotnet-install.sh -c 6.0 -InstallDir ./dotnet6
    - ./dotnet6/dotnet --version
  build: null
commands:
  - ./dotnet6/dotnet publish -c Release -o release
artifacts:
  baseDirectory: /release/wwwroot
  files:
    - '**/*'
  cache: null
  paths: []

Log output

``` # Put your logs below this line 2022-12-02T23:51:57.819Z [INFO]: # Cloning repository: https://git-codecommit.us-east-1.amazonaws.com/v1/repos/myapp 022-12-02T23:51:57.819Z [INFO]: # Cloning repository: https://git-codecommit.us-east-1.amazonaws.com/v1/repos/myapp 2022-12-02T23:52:18.997Z [INFO]: 2022-12-02T23:52:19.079Z [INFO]: Cloning into 'myapp'... remote: remote: Counting objects: 0 remote: Counting objects: 101 remote: Counting objects: 101 remote: Counting objects: 101, done. Receiving objects: 0% (1/101) Receiving objects: 1% (2/101) Receiving objects: 2% (3/101) Receiving objects: 3% (4/101) Receiving objects: 4% (5/101) Receiving objects: 5% (6/101) Receiving objects: 6% (7/101) Receiving objects: 7% (8/101) Receiving objects: 8% (9/101) Receiving objects: 9% (10/101) Receiving objects: 10% (11/101) Receiving objects: 11% (12/101) Receiving objects: 12% (13/101) Receiving objects: 13% (14/101) Receiving objects: 14% (15/101) Receiving objects: 15% (16/101) Receiving objects: 16% (17/101) Receiving objects: 17% (18/101) Receiving objects: 18% (19/101) Receiving objects: 19% (20/101) Receiving objects: 20% (21/101) Receiving objects: 21% (22/101) Receiving objects: 22% (23/101) Receiving objects: 23% (24/101) Receiving objects: 24% (25/101) Receiving objects: 25% (26/101) Receiving objects: 26% (27/101) Receiving objects: 27% (28/101) Receiving objects: 28% (29/101) Receiving objects: 29% (30/101) Receiving objects: 30% (31/101) Receiving objects: 31% (32/101) Receiving objects: 32% (33/101) Receiving objects: 33% (34/101) Receiving objects: 34% (35/101) Receiving objects: 35% (36/101) Receiving objects: 36% (37/101) Receiving objects: 37% (38/101) Receiving objects: 38% (39/101) Receiving objects: 39% (40/101) Receiving objects: 40% (41/101) Receiving objects: 41% (42/101) Receiving objects: 42% (43/101) Receiving objects: 43% (44/101) Receiving objects: 44% (45/101) Receiving objects: 45% (46/101) Receiving objects: 46% (47/101) Receiving objects: 47% (48/101) Receiving objects: 48% (49/101) Receiving objects: 49% (50/101) Receiving objects: 50% (51/101) Receiving objects: 51% (52/101) Receiving objects: 52% (53/101) Receiving objects: 53% (54/101) Receiving objects: 54% (55/101) Receiving objects: 55% (56/101) Receiving objects: 56% (57/101) Receiving objects: 57% (58/101) Receiving objects: 58% (59/101) Receiving objects: 59% (60/101) Receiving objects: 60% (61/101) Receiving objects: 61% (62/101) Receiving objects: 62% (63/101) Receiving objects: 63% (64/101) Receiving objects: 64% (65/101) Receiving objects: 65% (66/101) Receiving objects: 66% (67/101) Receiving objects: 67% (68/101) Receiving objects: 68% (69/101) Receiving objects: 69% (70/101) Receiving objects: 70% (71/101) Receiving objects: 71% (72/101) Receiving objects: 72% (73/101) Receiving objects: 73% (74/101) Receiving objects: 74% (75/101) Receiving objects: 75% (76/101) Receiving objects: 76% (77/101) Receiving objects: 77% (78/101) Receiving objects: 78% (79/101) Receiving objects: 79% (80/101) Receiving objects: 80% (81/101) Receiving objects: 81% (82/101) Receiving objects: 82% (83/101) Receiving objects: 83% (84/101) Receiving objects: 84% (85/101) Receiving objects: 85% (86/101) Receiving objects: 86% (87/101) Receiving objects: 87% (88/101) Receiving objects: 88% (89/101) Receiving objects: 89% (90/101) Receiving objects: 90% (91/101) Receiving objects: 91% (92/101) Receiving objects: 92% (93/101) Receiving objects: 93% (94/101) Receiving objects: 94% (95/101) Receiving objects: 95% (96/101) Receiving objects: 96% (97/101) Receiving objects: 97% (98/101) Receiving objects: 98% (99/101) Receiving objects: 99% (100/101) Receiving objects: 100% (101/101) Receiving objects: 100% (101/101), 216.24 KiB | 13.51 MiB/s, done. Resolving deltas: 0% (0/23) Resolving deltas: 4% (1/23) Resolving deltas: 8% (2/23) Resolving deltas: 13% (3/23) Resolving deltas: 17% (4/23) Resolving deltas: 21% (5/23) Resolving deltas: 26% (6/23) Resolving deltas: 30% (7/23) Resolving deltas: 34% (8/23) Resolving deltas: 39% (9/23) Resolving deltas: 43% (10/23) Resolving deltas: 52% (12/23) Resolving deltas: 56% (13/23) Resolving deltas: 60% (14/23) Resolving deltas: 65% (15/23) Resolving deltas: 69% (16/23) Resolving deltas: 73% (17/23) Resolving deltas: 78% (18/23) Resolving deltas: 82% (19/23) Resolving deltas: 86% (20/23) Resolving deltas: 91% (21/23) Resolving deltas: 100% (23/23) Resolving deltas: 100% (23/23), done. 2022-12-02T23:52:19.080Z [INFO]: # Switching to commit: 1467cb859283404dbfd35dabc00c07a70a25325d 2022-12-02T23:52:19.093Z [INFO]: Note: switching to '1467cb859283404dbfd35dabc00c07a70a25325d'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by switching back to a branch. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example: git switch -c Or undo this operation with: git switch - Turn off this advice by setting config variable advice.detachedHead to false HEAD is now at 1467cb8 changes 2022-12-02T23:52:19.133Z [INFO]: Successfully cleaned up Git credentials 2022-12-02T23:52:19.134Z [INFO]: # Checking for Git submodules at: /codebuild/output/src164832248/src/myapp/.gitmodules 2022-12-02T23:52:19.140Z [ERROR]: !!! CustomerError: Unable to parse build spec: bad indentation of a mapping entry (2:10) 1 | version: 1 2 | frontend: --------------^ 3 | phases: 4 | preBuild: 2022-12-02T23:52:19.140Z [INFO]: # Starting environment caching... 2022-12-02T23:52:19.686Z [INFO]: # Environment caching completed Terminating logging... ```

Additional information

No response

calavera commented 1 year ago

As the error says, the problem is that the buildspec is incorrectly indented. You can see the error in any YAML validator tool online too:

image

You can read more about YAML indentation here: https://www.tutorialspoint.com/yaml/yaml_indentation_and_separation.htm

github-actions[bot] commented 1 year ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

calnastic0 commented 1 year ago

As the error says, the problem is that the buildspec is incorrectly indented. You can see the error in any YAML validator tool online too:

image

You can read more about YAML indentation here: https://www.tutorialspoint.com/yaml/yaml_indentation_and_separation.htm

Thank you for the reply, I have updated the yml file indent, tried two online validators and passed both. The file content has been updated in the original post.

Now the build error is:

2022-12-03T00:52:54.552Z [ERROR]: !!! CustomerError: The artifacts key was not provided in the build spec

github-actions[bot] commented 1 year ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.