diff --git a/stdlib/netlify/netlify.sh.cue b/stdlib/netlify/netlify.sh.cue index 46306187..428a60fd 100644 --- a/stdlib/netlify/netlify.sh.cue +++ b/stdlib/netlify/netlify.sh.cue @@ -6,16 +6,17 @@ package netlify create_site() { url="https://api.netlify.com/api/v1/${NETLIFY_ACCOUNT:-}/sites" - response=$(curl -s -S -f -H "Authorization: Bearer $NETLIFY_AUTH_TOKEN" \ + response=$(curl -s -S --fail-with-body -H "Authorization: Bearer $NETLIFY_AUTH_TOKEN" \ -X POST -H "Content-Type: application/json" \ $url \ - -d "{\"name\": \"${NETLIFY_SITE_NAME}\", \"custom_domain\": \"${NETLIFY_DOMAIN}\"}" + -d "{\"name\": \"${NETLIFY_SITE_NAME}\", \"custom_domain\": \"${NETLIFY_DOMAIN}\"}" -o body ) if [ $? -ne 0 ]; then + cat body >&2 exit 1 fi - echo $response | jq -r '.site_id' + cat body | jq -r '.site_id' } site_id=$(curl -s -S -f -H "Authorization: Bearer $NETLIFY_AUTH_TOKEN" \