Skip to content

file.url returns a funtion intead a string #2500

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

Closed
icalvete opened this issue Aug 11, 2016 · 2 comments
Closed

file.url returns a funtion intead a string #2500

icalvete opened this issue Aug 11, 2016 · 2 comments

Comments

@icalvete
Copy link

icalvete commented Aug 11, 2016

Issue Description

After upload a file I'm trying to get the url but I get an error.

!!! With 2.2.16 all works fine. ¡¡¡

Steps to reproduce

I have this code within my main.js

Parse.Cloud.define("uploadsound", function(request, response) {
    var file = request.params.soundFile;
    console.log("File url: " + file.url);
}

Expected Results

A string

Actual Outcome

A complete function

Environment Setup

  • Server
    • parse-server version: 2.2.17
    • Operating System: ubuntu 14.04
    • Hardware: AWS EC2 c4.large
  • Database
    • MongoDB version: 3.0
    • Storage engine: WiredTiger
    • Hardware: AWS EC2 m4.large

Logs/Trace

error: Uncaught internal server error. [TypeError: function] TypeError: function
    at Object.urlFormat [as format] (url.js:532:11)
    at Request.init (/usr/lib/node_modules/parse-server/node_modules/request/request.js:243:25)
    at new Request (/usr/lib/node_modules/parse-server/node_modules/request/request.js:129:8)
    at request (/usr/lib/node_modules/parse-server/node_modules/request/index.js:55:10)
    at Object.module.exports [as httpRequest] (/usr/lib/node_modules/parse-server/lib/cloud-code/httpRequest.js:82:25)
    at /srv/cgib/cloud/main.js:325:15
    at _ret.v (/usr/lib/node_modules/parse-server/lib/Routers/FunctionsRouter.js:142:15)
    at new Promise (/usr/lib/node_modules/parse-server/node_modules/core-js/modules/es6.promise.js:191:7)
    at /usr/lib/node_modules/parse-server/lib/Routers/FunctionsRouter.js:122:16
    at handleCloudFunction (/usr/lib/node_modules/parse-server/lib/Routers/FunctionsRouter.js:145:10)
@joeyslack
Copy link

It seems to be the intended behavior. In the documentation I've found, you always access url as a function.

Use: file.url()

@icalvete
Copy link
Author

icalvete commented Aug 12, 2016

You are right.

My code works on 2.2.16 because a bug fixed at 2.2.17

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

No branches or pull requests

2 participants