Skip to content
Advertisement

Inconsisent S3 parameter validation error when running bash script in Ubuntu WSL

I’m experimenting with AWS Lambda by following along with the instructions here: https://github.com/awsdocs/aws-lambda-developer-guide/tree/main/sample-apps/java-basic.

Part of the setup instructions require running this script (2-deploy.sh):

JavaScript

When I run the script in WSL I get a parameter validation error:

JavaScript

However, when I manually run the last two lines of the file with the debug output it works correctly:

JavaScript

Why does this fail when run as a bash script? None of the characters stored in the variables are special to bash so I don’t see an issue with the variable substitution. The script is also using Unix-style line endings.

Advertisement

Answer

Based on the comments.

The issue was that the bucket-name.txt file contained an extra line. Subsequently $ARTIFACT_BUCKET contained the new line character, leading to the error.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement