[Retrospective](EN) Watch out for blank spaces when entering values


Environment and Prerequisite

  • GCP
  • GitHub Actions


Background

While setting up Workload Identity Federation for GCP authentication in GitHub Actions, there was a step to put the Audience value. After putting the value and running the workflow, I encountered the following error.

Error: google-github-actions/auth failed with: retry function failed after 4 attempts: failed to generate Google Cloud federated token for ***: (400) {"error":"invalid_grant","error_description":"The audience in ID Token [***] does not match the expected audience."}

Since I had copied and pasted the value, I used Ctrl + F to verify it multiple times, but the error persisted. After spending a few hours troubleshooting, I finally realized that there was a space (“ “) at the beginning of the input.

It would’ve been helpful if there had been a validation check to catch or warn about leading spaces, but there wasn’t. So the value was accepted with the space included. Of course, this was entirely my fault. I had a similar issue before at work when entering a password, so from now on, I’ll be more careful about blank space in my inputs.


Reference