Skip to content

Commit

Permalink
fix: check that amplify is actually ready
Browse files Browse the repository at this point in the history
  • Loading branch information
chmanie committed Dec 12, 2023
1 parent a97943b commit 7fede13
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/scripts/on-demand-env-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -284,14 +284,19 @@ npm i
# Build and run Docker images
npm run dev &

# Wait for graphql service to come up
while ! nc -z localhost 20002; do
sleep 10
# Believe it or not but this actually checks whether amplify is ready
while true; do
AMPLIFY_READY=$(curl -X POST -H "x-api-key: da2-fakeApiId123456" -H "Content-Type: application/json" -d '{"query":"query { __schema { types { name } } }"}' -s http://localhost:20002/graphql | jq 'has("data")')

if [[ "$AMPLIFY_READY" == "true" ]]; then
echo "Amplify seems to be up. Going our merry way."
break
else
echo "Amplify is not up yet, waiting..."
sleep 5
fi
done

# Wait for amplify to be really done
sleep 20

# Seed database (pass --yes to skip confirmation)
node ./scripts/create-data.js --yes

Expand Down

0 comments on commit 7fede13

Please sign in to comment.