In this first instalment in a series of posts focusing on head scratching errors, we will tackle the 'IndentationError' that sometimes pops up in Google Cloud Functions written in Python.
In a nutshell, if you are using 4 spaces for indentation in most of your code but then copy and paste a line with a tab in it instead, the Cloud Function deployment will result in something like the below. The error message reads
IndentationError: unindent does not match any outer indentation level.
The line immediately preceding the one printed out (
if request.args and 'message'...) is the culprit. Remove the tab from that line and replace it with 4 spaces. Problem solved and no more head scratching.