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

upload or download file error #1389

Closed
uqutub opened this issue Jun 22, 2016 · 3 comments
Closed

upload or download file error #1389

uqutub opened this issue Jun 22, 2016 · 3 comments
Assignees
Labels
api: storage Issues related to the Cloud Storage API.

Comments

@uqutub
Copy link

uqutub commented Jun 22, 2016

// download file function...
var bucket = gcs.bucket('xxx.appspot.com');
bucket.file('avatar_2_99737.jpg').download({
   destination: '/testAbc/avatar_2_99737.jpg'
}, function(err) {
   console.log(err)
});

Whenever i try to upload or download file i got this error.

../GoogleCloudStorage/node_modules/mime/mime.js:70
  var ext = path.replace(/.*[\.\/\\]/, '').toLowerCase();
                        ^

_TypeError: path.replace is not a function_
@stephenplusplus
Copy link
Contributor

stephenplusplus commented Jun 22, 2016

I haven't been able to reproduce. Also, we don't use the module mime. Could this be coming from a line of code that wasn't in your example? If not, a simple reproducible sample repo would be great to help debug.

@stephenplusplus stephenplusplus added the api: storage Issues related to the Cloud Storage API. label Jun 22, 2016
@stephenplusplus
Copy link
Contributor

I'm going to close, but if you can share a small repo that I can clone to reproduce the bug, I'll re-open.

@stephenplusplus
Copy link
Contributor

Another issue (#1445) popped up with this same error. We traced it back to an argument type mismatch. gcloud takes an object with either a keyFilename string or a credentials object. In #1445, an object was provided, but under the name keyFilename. String functions were trying to be called on that object, which is what threw the error. Naming it credentials instead solved the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API.
Projects
None yet
Development

No branches or pull requests

2 participants