Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more info to errors #57

Open
lorensr opened this issue Jan 24, 2015 · 4 comments
Open

Add more info to errors #57

lorensr opened this issue Jan 24, 2015 · 4 comments

Comments

@lorensr
Copy link

lorensr commented Jan 24, 2015

For instance, all I see from this line

return new Meteor.Error(xhr.statusText + " - " + xhr.status,

is

 Error: Failed to upload file to cloud storage [Bad Request - 400]
    at getError (upload.js:163)
    at XMLHttpRequest.<anonymous> (upload.js:176)

and I have no idea what went wrong. But the xhr does have more informative fields:

image

Thanks for this great package!

@gsuess
Copy link
Contributor

gsuess commented Jan 24, 2015

This could be tricky as each storage service has a different way of structuring their error documents and the client library has no way of know how to handle it.

What can be done however is to attach the parsed raw document that the server responds with to the error object.

@MichaelJCole
Copy link

Error: Failed to upload file to cloud storage [ - 0] - seems to indicate a CORS issue

@wiserweb
Copy link

wiserweb commented Dec 20, 2019

Consider this adhoc documentation

Error: Failed to upload file to cloud storage [ - 0] may also indicate an incorrect Metadata Key that is set by specifying a key via the X-Account-Meta-Temp-Url-Key header.

Note that the X-Account-Meta-Temp-Url-Key is set at the Project level only and not for each individual container.

Any class 200 status code indicates success.

Here's a one liner to set the metadata key using curl.

curl -I -X POST -H 'X-Auth-Token: your-auth-token' -H 'X-Account-Meta-Temp-Url-Key: your-key' https://storage.clouddrive.com/v1/AUTH_your-tenantid-goes-here

and don't forget to set CORS - and don't use * origin in prod..

curl -I -X POST -H 'X-Auth-Token: your-auth-token' -H 'X-Container-Meta-Access-Control-Allow-Origin: *' -H 'X-Container-Meta-Access-Expose-Headers: etag location x-timestamp x-trans-id Access-Control-Allow-Origin' https://storage.clouddrive.com/v1/AUTH_your-tenantid-goes-here

These two curl commands should resolve the error message.

@Floriferous
Copy link

It's a shame that it's really hard to override individual functions in this package. the getError method for example is deeply nested in a closure. Cloning the package in your own repo appears to be the simplest fix for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants