Home > front end >  CURL missing required header when uploading file to google cloud using PUT
CURL missing required header when uploading file to google cloud using PUT

Time:08-13

I'm trying to upload a file inside my docker pod using curl by running this:

curl -X PUT -H 'Content-Type: video/mp4' -H "Content-Length:12345" --upload-file ./output/file/path "SIGNED_URL"

I'm trying to run this inside the pod using google cloud console but when i do i get this this error:

[1] 3205
[2] 3206
[3] 3208
[4] 3209
[5] 3210
-bash: X-Goog-Date=20220812T114055Z: command not found
-bash: X-Goog-Credential=cloudrun%project.iam.gserviceaccount.com%..._request: command not found
-bash: X-Goog-Expires=7199: command not found
-bash: X-Goog-SignedHeaders=content-type;host: command not found
-bash: X-Goog-Signature=...: command not found
[2]   Exit 127                X-Goog-Credential=cloudrun%project.iam.gserviceaccount.com%...
[3]   Exit 127                X-Goog-Date=20220812T114055Z
[4]-  Exit 127                X-Goog-Expires=7199
[5]   Exit 127                X-Goog-SignedHeaders=content-type;host
user@cloudshell:~ (project)$ Fetching cluster endpoint and auth data.
kubeconfig entry generated for cluster-1.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0<?xml version='1.0' encoding='UTF-8'?><Error><Code>MissingSecurityHeader</Code><Message>Your request was missing a required header.</Message><Details>x-go100  700k  100   185  100  700k    480  1816k --:--:-- --:--:-- --:--:-- 1813k

[1]   Done                    gcloud container clusters get-credentials cluster-1 --region us-central1 --project project && kubectl exec nca1ozmnicx5-shsfx -c jobcontainer -- curl -X PUT -H 'Content-Type: video/mp4' -H "Content-Length:12345" --upload-file ./output/file/path SIGNED_URL

I saw this answer but I don't want to use oauth2 since I already have a signed url. Also I need someone to put me on the right track for the other options such as gsutil I'm a bit lost on that.

I'm using an ubuntu image.

Edit: If i try to donwload gsutil in accordance to this tutorial it asks me to choose an account while I download it but i can't use it thus I can't set it up. It might a bit bothersome to setup gsutil inside my pod. So I rather not unless I have to.

CodePudding user response:

You need to use the command as given here :

curl -X PUT -H 'Content-Type: application/octet-stream' --upload-file 6e069c12-649d-4d87-9401-0d2f81a7bbff "<<SIGNEDURL>>"
  • Related