AWS Amplify Build Error - Mismatched Brackets Found In The Schema - yaml

End Desire:
To build my AWS Amplify project in the dev environment, using full-stack CI/CD. So for example, pushing my changes to Code Commit will build the backend resources.
Build Logs:
2023-01-06T06:19:26.457Z [INFO]: [33mNote: It is recommended to run this command from the root of your app directory[39m
2023-01-06T06:19:27.797Z [WARNING]: - Initializing your environment: dev
2023-01-06T06:19:29.164Z [WARNING]: - Building resource api/project
2023-01-06T06:19:33.756Z [WARNING]: - Building resource auth/project
2023-01-06T06:19:33.902Z [WARNING]: - Building resource storage/project
2023-01-06T06:19:33.939Z [WARNING]: ✔ Initialized provider successfully.
2023-01-06T06:19:34.452Z [WARNING]: ✖ There was an error initializing your environment.
2023-01-06T06:19:34.453Z [INFO]: 🛑 Syntax Error: mismatched brackets found in the schema. Unexpected ) at line 239 in the schema.
2023-01-06T06:19:34.453Z [INFO]: Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/
buildspec.yml:
version: 0.1
frontend:
phases:
preBuild:
commands:
- npm i
build:
commands:
- npm run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/*
Checks:
I have checked the graphql.schema for errors.
I have removed the testing section in the buildspec.
I have added amplify push --simple as recommended here
I've ran npm run build on my local CLI successfully

In the AWS Amplify console, under build settings, the AWS CLI version was "latest". Changing the AWS CLI version to 10.4.0 fixed the issue.
View AWS CLI Versioning here: https://www.npmjs.com/package/#aws-amplify/cli?activeTab=versions
Rather than going to 10.4.0, go back a couple versions from the latest AWS CLI version at the time.

Related

How to deploy GoLang Binaries to CF

Hi we are trying to deploy golang binaries to cf.
for example main.exe which is in /deploy/ folder along with mainfest file
Note: It is also observed that if we push the whole project app then it works. but if we try to push only binaries then we get the below error
And Manifest file contains following info
applications:
- name: test-app
command: test-app
env:
GO_INSTALL_PACKAGE_SPEC: ./
**ERROR** To use go native vendoring set the $GOPACKAGENAME
environment variable to your app's package name
**ERROR** Unable to determine import path: GOPACKAGENAME unset
After adding GOPACKAGENAME: main since main.exe is our binary name we get following error below
Failed to compile droplet: Failed to run finalize script: exit status 12
Cell 507b6e9c-c5c5-4685-9a71-d7cc1c876f5a stopping instance 6a92ff73-76ec-4baf-8a3e-54b54cfa307e
BuildpackCompileFailed - App staging failed in the buildpack compile phase
thanks #Volker for pointing out
for above issue:
first we have to build with following command (used make file)
GOOS="linux" go build main.go
then copy that main binary to /deploy folder
then manifest file in the deploy folder
applications:
- name: test-app
command: ./main
stack: cflinuxfs3
buildpacks:
- https://github.com/cloudfoundry/binary-buildpack.git
Then to push to cf
cf push -f ./manifest-template.yml

How do I properly create buildspec.yml file for Laravel Application using AWS CodePipeline

I am using AWS CodePipeline for the first time and trying to figure out how to properly create my buildspec.yml file for my Laravel application. There are few resources on the internet.
I have the following in my buildspec.yml file currently:
version: 0.2
phases:
install:
commands:
- curl -s https://getcomposer.org/installer | php
- mv composer.phar /usr/local/bin/composer
- php --version
build:
commands:
- echo Build started on `date`
- echo Installing composer deps
- composer install
- cp extra/.env ./
- php artisan cache:clear
post_build:
commands:
- echo Build completed on `date`
artifacts:
type: zip
files:
- '**/*'
name: clyde-$(date +%Y-%m-%d)
The CodeBuild is successful and this does deploy to Elastic Beanstalk. I did change the configuration in Elastic Beanstalk so the root is /public (for Laravel). However, when I go to the URL, the first line of code run presents an error like below:
View [inc\navbar] not found. (View: /var/app/current/resources/views/layouts/app.blade.php)
This leads me to believe something is not built properly.
To make it work, it will need to use a complete Pipeline: CodeCommit-->CodeBuild-->CodeDeploy
Inside your Artifact bucket there will be two objects generated in the process:
s3://codepipeline-us-east-1-<001122334455>/SourceArtif/
s3://codepipeline-us-east-1-<001122334455>/BuildArtif/
The first one is obtained in the initial phase of the pipeline from CodeCommit.
The second one is created by CodeBuild. The resultant zip file will be exactly the same as that one from CodeCommit. So it seems, the CodeBuild is only testing but not saving the Artifact with results from the instructions specified in buildspec.yml.
The third phase, CodeDeploy will obtain the code from the Artifact and it will need to Build again via scripts referred by appspec.yml.
version: 0.0
os: linux
files:
- source: /
destination: /web/project/html
hooks:
BeforeInstall:
- location: scripts/install_dependencies.sh
timeout: 300
runas: root
AfterInstall:
- location: scripts/build_again.sh
timeout: 600
runas: user
ApplicationStart:
- location: scripts/start_application.sh
timeout: 300
runas: root
The build_again.sh file will need to include same commands you are using in buildspec.yml (build section), then your Laravel project should be working.

Travis CI Deploy to AWS ElasticBeanstalk

Hi I currently try to deploy my react app to AWS Elastic Bean Stalk through travis CI. But it fail.. what should I change in my travis yml??
Here is my .travis.yml
sudo: required
services:
- docker
before_install:
- docker build -t sample:dev .
script:
- docker run -e CI=true sample:dev npm run test -- --coverage
deploy:
provider: elasticbeanstalk
region: "us-west-1"
app: "my-app"
env: "MyApp-env"
bucket_name: "xxxx"
bucket_path: "xxx"
on:
branch: master
access_key_id: $AWS_ACCESS_KEY
secret_access_key:
secure: "$AWS_SECRET_KEY"
But I failed to deploy it in aws elastic bean stalk. Here is the message from travis ci:
The command "docker run -e CI=true sample:dev npm run test -- --coverage" exited with 0.
dpl_0
1.27s$ rvm $(travis_internal_ruby) --fuzzy do ruby -S gem install dpl
dpl.1
Installing deploy dependencies
Successfully installed jmespath-1.4.0
Successfully installed aws-eventstream-1.0.3
Successfully installed aws-sigv4-1.1.1
NEWER VERSION AVAILABLE: Please upgrade to AWS SDK For Ruby V3
Successfully installed aws-sdk-core-2.11.471
NEWER VERSION AVAILABLE: Please upgrade to AWS SDK For Ruby V3
Successfully installed aws-sdk-resources-2.11.471
NEWER VERSION AVAILABLE: Please upgrade to AWS SDK For Ruby V3
Successfully installed aws-sdk-2.11.471
Successfully installed rubyzip-1.3.0
Successfully installed dpl-elastic_beanstalk-1.10.15
8 gems installed
!!! AWS Elastic Beanstalk support is experimental !!!
dpl.2
Preparing deploy
Cleaning up git repository with git stash --all. If you need build artifacts for deployment, set deploy.skip_cleanup: true. See https://docs.travis-ci.com/user/deployment#Uploading-Files-and-skip_cleanup.
No local changes to save
NEWER VERSION AVAILABLE: Please upgrade to AWS SDK For Ruby V3
dpl.3
Deploying application
No stash entries found.
/home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/seahorse/client/plugins/raise_response_errors.rb:15:in call': The request signature we calculated does not match the signature you provided. Check your key and signing method. (Aws::S3::Errors::SignatureDoesNotMatch)
from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/aws-sdk-core/plugins/s3_sse_cpk.rb:19:incall'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/aws-sdk-core/plugins/s3_dualstack.rb:24:in call'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/aws-sdk-core/plugins/s3_accelerate.rb:34:incall'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/aws-sdk-core/plugins/jsonvalue_converter.rb:20:in call'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/aws-sdk-core/plugins/idempotency_token.rb:18:incall'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/aws-sdk-core/plugins/param_converter.rb:20:in call'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/seahorse/client/plugins/response_target.rb:21:incall'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/seahorse/client/request.rb:70:in send_request'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/seahorse/client/base.rb:207:inblock (2 levels) in define_operation_methods'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-resources-2.11.471/lib/aws-sdk-resources/request.rb:24:in call'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-resources-2.11.471/lib/aws-sdk-resources/operations.rb:41:incall'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-resources-2.11.471/lib/aws-sdk-resources/operation_methods.rb:19:in block in add_operation'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-elastic_beanstalk-1.10.15/lib/dpl/provider/elastic_beanstalk.rb:131:inupload'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-elastic_beanstalk-1.10.15/lib/dpl/provider/elastic_beanstalk.rb:49:in push_app'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.15/lib/dpl/provider.rb:199:inblock in deploy'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.15/lib/dpl/cli.rb:41:in fold'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.15/lib/dpl/provider.rb:199:indeploy'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.15/lib/dpl/cli.rb:32:in run'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.15/lib/dpl/cli.rb:7:inrun'
from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.15/bin/dpl:5:in <top (required)>'
from /home/travis/.rvm/gems/ruby-2.4.5/bin/dpl:23:inload'
from /home/travis/.rvm/gems/ruby-2.4.5/bin/dpl:23:in `'
failed to deploy
Based on the new version of Travis CI, following lines code, you need to update
secret_access_key:
secure: "$AWS_SECRET_KEY"
Change it to :
secret_access_key: "$AWS_SECRET_KEY"
Alse need to add "skip_cleanup: true" under deploy:
Because Travis CI now consider default variable as secure.
Looking at the first error from your output:
call': The request signature we calculated does not match the signature you provided. Check your key and signing method. (Aws::S3::Errors::SignatureDoesNotMatch)
I got the same error and it was caused by a mismatch on the access_key_id and secret_access_key. I resolved it by running:
travis encrypt --add deploy.access_key_id <access_key_id>
travis encrypt --add deploy.secret_access_key <secret_access_key>

The command "go get github.com/gohugoio/hugo" failed and exited with 2 during

I am building websites with Hugo and deploying using Travis-Ci. Recently (about within 3 days) an error occurred:
$ go get github.com/gohugoio/hugo
# github.com/gohugoio/hugo/tpl/internal/go_templates/fmtsort
../../gohugoio/hugo/tpl/internal/go_templates/fmtsort/sort.go:58:18: mapValue.MapRange undefined (type reflect.Value has no field or method MapRange)
The command "go get github.com/gohugoio/hugo" failed and exited with 2 during .
Since the code errored at go get line, I think it must be caused by some updates by Hugo.
.travis.yml
sudo: false
language: go
git:
depth: 1
install:
- go get github.com/gohugoio/hugo
script:
- git submodule init
- git submodule update
- hugo
# Deploy to GitHub pages
deploy:
provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN
local_dir: public
on:
branch: master
Since Hugo 0.48, Hugo uses the Go Modules support built into Go 1.11 to build.
docker run -it golang:1.10
root#2598ed7e489d: go get github.com/gohugoio/hugo
src/github.com/gohugoio/hugo/tpl/internal/go_templates/fmtsort/sort.go:58:18: mapValue.MapRange undefined (type reflect.Value has no field or method MapRange)
docker run -it golang:1.11
root#07e6e634656a: go get https://github.com/gohugoio/hugo
will not return any error
using go versions > 1.11 will not cause this issue.
In example 1,similar error is there.
In example 2,it is installed successfully.

How to properly set up CircleCI plugin

I am trying to integrate CircleCI plugin with my spring-pet-clinic project. I was following the instruction on CircleCI web page. I have created .circleci folder inside my project root folder.
Inside .circleci I have added config.yml file and copy-pasted config from CircleCI page
My config was like this:
# Use the latest 2.1 version of CircleCI pipeline processing engine,
see https://circleci.com/docs/2.0/configuration-reference/
version: 2.1
# Use a package of configuration called an orb, see
https://circleci.com/docs/2.0/orb-intro/
orbs:
# Declare a dependency on the welcome-orb
welcome: circleci/welcome-orb#0.3.1
# Orchestrate or schedule a set of jobs, see
https://circleci.com/docs/2.0/workflows/
workflows:
# Name the workflow "Welcome"
Welcome:
# Run the welcome/run job in its own container
jobs:
- welcome/run
After I ran the project CircleCI has thrown an error. Especially this one: "Config Processing Error: Don't rerun"
$#!/bin/sh -eo pipefail
# No configuration was found in your project. Please refer to
https://circleci.com/docs/2.0/ to get started with your
configuration.
#
# -------
# Warning: This configuration was auto-generated to show you
the
message above.
# Don't rerun this job. Rerunning will have no effect.
false
Exited with code 1
Spin Up Environment looks like this
Build-agent version 1.0.10572-3ce00c85 (2019-04-
15T22:09:28+0000)
Docker Engine Version: 17.05.0-ce
Kernel Version: Linux b0a81c56acff 4.4.0-144-generic
#170~14.04.1-
Ubuntu SMP Mon Mar 18 15:02:05 UTC 2019 x86_64 Linux
Starting container bash:4.4.19
using image
bash#sha256:9f0a4aa3c9931bd5fdda51b1b2b74a0398a8eabeaf9519d807e010b9d9d41993
Using build environment variables
BASH_ENV=/tmp/.bash_env-5cbebf83d4b030000849b60f-0-build
CI=true
CIRCLECI=true
CIRCLE_BRANCH=master
CIRCLE_BUILD_NUM=5
CIRCLE_BUILD_URL=https://circleci.com/gh/sajmon2325/Spring-
Pet-
Clinic/5
CIRCLE_COMPARE_URL=
CIRCLE_JOB=Build Error
CIRCLE_NODE_INDEX=0
CIRCLE_NODE_TOTAL=1
CIRCLE_PREVIOUS_BUILD_NUM=4
CIRCLE_PROJECT_REPONAME=Spring-Pet-Clinic
CIRCLE_PROJECT_USERNAME=sajmon2325
CIRCLE_REPOSITORY_URL=git#github.com:sajmon2325/Spring-Pet-
Clinic.git
CIRCLE_SHA1=48f6db114b41c338e606de32d8648c64ba5119fd
CIRCLE_SHELL_ENV=/tmp/.bash_env-5cbebf83d4b030000849b60f-0-
build
CIRCLE_STAGE=Build Error
CIRCLE_USERNAME=sajmon2325
CIRCLE_WORKFLOW_ID=2789d93e-f1e4-4c81-93f1-846f7d38c107
CIRCLE_WORKFLOW_JOB_ID=670105ca-617e-445e-9b5e-6ac57f6af8da
CIRCLE_WORKFLOW_UPSTREAM_JOB_IDS=
CIRCLE_WORKFLOW_WORKSPACE_ID=2789d93e-f1e4-4c81-93f1-
846f7d38c107
CIRCLE_WORKING_DIRECTORY=~/project
Using environment variables from project settings and/or
contexts
CIRCLE_JOB=**REDACTED**
So at first I thought that I have only a skeleton of CircleCI configuration, that's why I have edited my config.yml file to look like this (the actual version)
# Java Maven CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-java/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/openjdk:11-browsers-legacy
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4
working_directory: ~/repo
environment:
# Customize the JVM maximum heap limit
MAVEN_OPTS: -Xmx3200m
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "pom.xml" }}
# fallback to using the latest cache if no exact match
is
found
- v1-dependencies-
- run: mvn install -DskipTests
- run: mvn dependency:go-offline
- save_cache:
paths:
- ~/.m2
key: v1-dependencies-{{ checksum "pom.xml" }}
# run tests!
- run: mvn integration-test
But even this is not working. I still have the same error:
$#!/bin/sh -eo pipefail
# No configuration was found in your project. Please refer to https://circleci.com/docs/2.0/ to get started with your configuration.
#
# -------
# Warning: This configuration was auto-generated to show you the message above.
# Don't rerun this job. Rerunning will have no effect.
false
Exited with code 1
I just need to successfully integrate CircleCi plugin with my project. If you need to see my repo, here is the link: https://github.com/sajmon2325/Spring-Pet-Clinic.git
The problem is that .circleci is not in the root of the repository. It is currently in sfg-pet-clinic/, and the CircleCI build process won't find it there.

Resources