Open maximelebastard opened 4 years ago
Hi there! I am experiencing the same issue, but the thing is that if I use the amazon linux extras golang topic (v 1.11) then I would need to downgrade the github.com/aws/aws-lambda-go v1.XX dependency to whatever version is compatible with 1.11. This seems kind of hacky and forces us to use a quite old version of Go. Any updates on this issue?
I am getting the same issue when trying to build using the CI/CD of amplify. Everything works fine locally, but won't build when commit to github->amplify.
error .."executable was not found in PATH, make sure it's available. It can be installed from https://golang.org/doc/install"
I am also getting same issue when trying to build using the CI/CD of amplify. Everything works fine locally, but won't build when commit to aws codecommit. I am getting below error. go executable was not found in PATH, make sure it's available. It can be installed from https://golang.org/doc/install
This is still an issue as of 10.6.1. When deploying from hook all is well till
# Starting phase: build
2023-01-11T15:35:22.890Z [INFO]: [0mAmplify AppID found: d3np8nesr47z3c. Amplify App name is:[0m
2023-01-11T15:35:22.937Z [INFO]: [0mBackend environment develop found in Amplify Console app:[0m
2023-01-11T15:35:27.205Z [WARNING]: - Fetching updates to backend environment: develop from the cloud.
2023-01-11T15:35:30.062Z [WARNING]: - Building resource api/
2023-01-11T15:35:31.190Z [INFO]: ⚠️ WARNING: your GraphQL API currently allows public create, read, update, and delete access to all models via an API Key. To configure PRODUCTION-READY authorization rules, review: https://docs.amplify.aws/cli/graphql/authorization-rules
2023-01-11T15:35:36.385Z [INFO]: ✅ GraphQL schema compiled successfully.
Edit your schema at /codebuild/output/src618941925/src//amplify/backend/api//schema.graphql or place .graphql files in a directory at /codebuild/output/src618941925/src//amplify/backend/api//schema
2023-01-11T15:35:36.387Z [WARNING]: - Building resource auth/
2023-01-11T15:35:36.494Z [WARNING]: - Building resource auth/userPoolGroups
2023-01-11T15:35:36.784Z [WARNING]: - Building resource storage/
2023-01-11T15:35:36.821Z [WARNING]: ✔ Successfully pulled backend environment develop from the cloud.
2023-01-11T15:35:37.436Z [INFO]: ✅
2023-01-11T15:35:38.921Z [INFO]: [33mNote: It is recommended to run this command from the root of your app directory[39m
2023-01-11T15:35:40.362Z [WARNING]: - Initializing your environment: develop
2023-01-11T15:35:43.084Z [WARNING]: - Building resource api/
2023-01-11T15:35:44.346Z [INFO]: ⚠️ WARNING: your GraphQL API currently allows public create, read, update, and delete access to all models via an API Key. To configure PRODUCTION-READY authorization rules, review: https://docs.amplify.aws/cli/graphql/authorization-rules
2023-01-11T15:35:48.274Z [INFO]: ✅ GraphQL schema compiled successfully.
Edit your schema at /codebuild/output/src618941925/src//amplify/backend/api//schema.graphql or place .graphql files in a directory at /codebuild/output/src618941925/src//amplify/backend/api/battlegi/schema
2023-01-11T15:35:48.276Z [WARNING]: - Building resource auth/
2023-01-11T15:35:48.357Z [WARNING]: - Building resource auth/userPoolGroups
2023-01-11T15:35:48.582Z [WARNING]: - Building resource storage/
2023-01-11T15:35:48.609Z [WARNING]: ✔ Initialized provider successfully.
2023-01-11T15:35:49.571Z [INFO]: [31mgo executable was not found in PATH, make sure it's available. It can be installed from https://golang.org/doc/install[39m
2023-01-11T15:35:49.571Z [INFO]: [31mgo executable was not found in PATH, make sure it's available. It can be installed from https://golang.org/doc/install[39m
2023-01-11T15:35:49.571Z [WARNING]: ✖ There was an error initializing your environment.
2023-01-11T15:35:49.572Z [INFO]: 🛑 Missing required dependencies to package
2023-01-11T15:35:49.572Z [INFO]: Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/
2023-01-11T15:35:49.575Z [INFO]:
2023-01-11T15:35:49.575Z [INFO]: Session Identifier: de2d11af-8e4e-4e88-8318-ca3bb5188ee0
2023-01-11T15:35:49.576Z [WARNING]: - Creating Zip
2023-01-11T15:35:49.625Z [INFO]: ✅ Report saved: /tmp//report-1673451349584.zip
2023-01-11T15:35:49.625Z [INFO]:
2023-01-11T15:35:49.625Z [WARNING]: - Sending zip
2023-01-11T15:35:50.738Z [WARNING]: ✔ Done
2023-01-11T15:35:50.739Z [INFO]: Project Identifier: 333a9cfc635640cfaec2a93c7b0bbe98
2023-01-11T15:35:50.773Z [ERROR]: !!! Build failed
2023-01-11T15:35:50.773Z [ERROR]: !!! Non-Zero Exit Code detected
2023-01-11T15:35:50.774Z [INFO]: # Starting environment caching...
2023-01-11T15:35:50.774Z [INFO]: # Environment caching completed
Terminating logging...
Still no solution...
@Mr-Raian I believe the solution is the workaround. If you could update your build settings by going to AWS Amplify -> App Settings -> Build Settings with something that looks similar. It should work, though note that your Go lambda functions cannot be greater than version 1.18 due to another bug preventing 1.18+ Go modules from compiling.
version: 1
backend:
phases:
preBuild:
commands:
- yum install -y golang
build:
commands:
- '# Execute Amplify CLI with the helper script'
- amplifyPush --simple
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- npm run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/*
I wasn't aware of the existence of the preBuild
phase, thanks to @MtthwBrwng for pointing it out. I got it working, and with go 1.20, this is how my amplify.yml
looks
...
phases:
preBuild:
commands:
- wget --no-verbose https://go.dev/dl/go1.20.5.linux-amd64.tar.gz
- rm -rf /usr/local/go
- tar -C /usr/local -xzf go1.20.5.linux-amd64.tar.gz
build:
commands:
- '# Execute Amplify CLI with the helper script'
- export PATH=$PATH:/usr/local/go/bin
- go version
- amplifyPush --simple
...
Please describe which feature you have a question about?
I've created a GoLang function as documented. I can push it sucessfully from my computer. But when running amplifyPush from the console it seems it cannot build the function as go isn't available on the machine.
I have to install golang everytime which consumes time and money. It is akward that amplify console cannot natively build a go function.
Amplify version latest 4.29.3
amplify.yml
Build settings
Console output for the backend step
Workaround
As a workaround, I install go by running this code. But that's not ideal.