While there can be several reasons for error, most likely is:
GCP VM you created does not has permission to write to storage bucket. The VM creation command that I have written (as below) has scope: “https://www.googleapis.com/auth/cloud-platform” which gives VM permission to all the GCP APIs including GCS Writes.

gcloud compute instances create sftp-test --zone=us-central1-c --machine-type=n1-standard-1 --subnet=default  --scopes=https://www.googleapis.com/auth/cloud-platform --image-family=ubuntu-1604-lts --image-project=ubuntu-os-cloud --boot-disk-size=10GB --boot-disk-type=pd-standard --boot-disk-device-name=sftp-test

If you created your VM from UI, it only gives GCS reads permission to VM.

Database Migrations Engineer, Google Cloud

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store