'Google cloud function deploy throwing /usr/bin/env: 'sh\r': No such file or directory; Error ID: 42fc8383

A google cloud functions project in java, which has worked perfectly before is suddenly all of a sudden throwing the following error

(gcloud.functions.deploy) OperationError: code=3, message=Build failed: /usr/bin/env: 'sh\r': No such file or directory; Error ID: 42fc8383

This is my deploy command

gcloud functions deploy pdf-function --entry-point de.uniba.dsg.cloudfunction.Function --runtime java11 --region europe-west3 --trigger-http --allow-unauthenticated --env-vars-file .env.yaml

There is no such environment variable named sh\r in the .env.yaml file, nor have I used it anywhere. Also this has ran without any problems previously.

EDIT: This is most likely also a git issue, but I still haven't been able to solve it. I use a windows OS. I have changed between branches in the git and since then the problem started, even though the code is unchanged. I am using gradle as the build tool.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source