diff --git a/.github/workflows/scripts/on-demand-env-script.sh b/.github/workflows/scripts/on-demand-env-script.sh index 7b1e3f33d6f..3aa50c2d709 100644 --- a/.github/workflows/scripts/on-demand-env-script.sh +++ b/.github/workflows/scripts/on-demand-env-script.sh @@ -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