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

Cloud-code: problem creating parse-file #1044

Closed
Dibeapp opened this issue Mar 15, 2016 · 5 comments
Closed

Cloud-code: problem creating parse-file #1044

Dibeapp opened this issue Mar 15, 2016 · 5 comments

Comments

@Dibeapp
Copy link

Dibeapp commented Mar 15, 2016

Hello,

I managed to deploy and run my parse-server locally connecting it to hosted mongolab, that's great! Almost everything seems to work fine!!

I have a small issue with the creation of a parse-file in cloud code: with the following piece of code I'm calling a service to generate a QR Code, then I am storing the generated code as a parse-file and attaching it to an object. It works OK with the parse hosted services but not working with local parse-server, it seems to store an empty file...

any known issues with parse files and cloud code ?

Parse.Cloud.httpRequest({
url: "https://api.qrserver.com/v1/create-qr-code/?data="+passURL+"&size=220x220",
followRedirects: true,
success:function(httpResponse) {
console.log('generatePass:calling qr...OK');
console.log('generatePass:saving file...');
var parseFile = new Parse.File(shortId, {base64: httpResponse.buffer.toString('base64', 0, httpResponse.buffer.length)});
parseFile.save({
success:function() {
console.log('generatePass:saving file...OK');
photoObj.set("qrcode", parseFile);

@gfosco
Copy link
Contributor

gfosco commented Mar 15, 2016

Have you checked that httpResponse.buffer is populated?

@Dibeapp
Copy link
Author

Dibeapp commented Mar 16, 2016

Thank you very much for the answer! I'll try to debug it today and give you more info today... I was wondering is there is a known issue since the same piece of code works perfectly in the "classic" parse.com

@Dibeapp
Copy link
Author

Dibeapp commented Mar 21, 2016

Hello,

I'm still struggling with this problem. I made this test: I hardcoded the url of the QR code service to:

Parse.Cloud.httpRequest({
url: "https://chart.googleapis.com/chart?cht=qr&chs=200x200&chl=abcd",
...

and I deployed it in both versions of the parse server cloud-code: hosted and local. The funny thing is that the results returned by the two versions of the server are different (check below).

May be the two versions of parse server use encode the results differently?

Using hosted parse, the base64 string returned is this:
(result is truncated but it is actually an image because shows it correclty in the app)

iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAIAAAAiOjnJAAAABmJLR0QA/wD/AP+gvaeTAAADMUlEQVR4nO3dUYrbMBRA0bp0/1tOf0v9Y4SupHjOWcAkA5cHDzny9fl8fsFsv3d/Ad5JWCSERUJYJIRFQlgkhEVCWCSERUJYJIRFQlgkhEVCWCSERUJYJIRFQlgkhEVCWCSERUJYJIRFQlgkhEVCWCSERUJYJIRFQlgkhEVCWCSERUJYJIRFQlgk/iz+vOu6Fn/iv+43+T75Pk/u/73/nbHP6iy+xdjEIiEsEsIiISwSwiKxeiu867aVsY1v5e62939PmVgkhEVCWCSERUJYJPZvhXdjG83YhjV2xnfaNnfg20xNLBLCIiEsEsIiISwSJ26Fp9m7J34pE4uEsEgIi4SwSAiLhK3wf7N+afjDmVgkhEVCWCSERUJYJE7cClfuXKftd6d9n2EmFglhkRAWCWGREBaJ/Vvh3ntRZv2ucOyZ0u13wnRMLBLCIiEsEsIiISwS12sOp2bxBOkUJhYJYZEQFglhkRAWiW99X2H3DsFZ76pYeXp44H04JhYJYZEQFglhkRAWidVbYbeX7X2P/Kwd8DXPnZpYJIRFQlgkhEVCWCRWP0HabTRjO2B35ngaZ4W8gbBICIuEsEgIi8T+22bG7D1zHDP2d7Y/CzrGxCIhLBLCIiEsEsIisf+2mfN/fzd25rjymdIDmVgkhEVCWCSERUJYJPafFY5tPd2utHIv6955sZ2JRUJYJIRFQlgkhEXiPb8rfGLlM5yzThifOHBPNLFICIuEsEgIi4SwSHzrWeET3RslTrsz50AmFglhkRAWCWGREBaJ/Vvh3WnnZd1dprPM+oYTmVgkhEVCWCSERUJYJE7cClfqNtC9z51uf6bUxCIhLBLCIiEsEsIi8dO3wrsnO9fKLewrdsA7E4uEsEgIi4SwSAiLxIlb4d4dZ+WvEVe... (truncated)

Using parse local, the base64 string returned by the service is:
(this is apparantlely not base64 of an image)

77+9UE5HDQoaCgAAAA1JSERSAAAA77+9AAAA77+9CAIAAAAiOjnvv70AAAAGYktHRADvv70A77+9AO+/ve+/ve+/ve+/ve+/vQAAAzFJREFUeO+/ve+/ve+/vVHvv73vv70wFEDRunTvv71bTn9L77+9Y++/ve+/ve+/vXjvv71Z77+9JAPvv70HDznvv73vv73vv718fu+/vWzvv713fwHvv71JWCTvv71FQlgk77+9RUJYJO+/vUVCWCTvv71FQlgk77+9RUJYJO+/vUVCWCTvv71FQlgk77+9RUJYJO+/vUVCWCTvv71FQlgk77+9RUJYJO+/vUVCWCTvv71FQlgk77+9RUJYJO+/vUVCWCTvv71FQlgk77+9RUJYJO+/vSzvv73vv73vv73vv70Wf++/ve+/ve+/vTfvv70+77+9Pk/vv73vv73vv73vv73vv73vv73vv73vv70s77+977+977+977+9IiEsEu+/vSIhLBLvv70i77+9eivvv73rtpXvv73vv71v77+977+977+977+9f0/vv71YJO+/vUVCWCTvv71FQlgk77+9b++/vXdjG++/vdiGNXbvv71377+9Nnfvv73vv71MTSwS77+9IiEsEu+/vSIhLBInbu+/ve+/vdm7J34pE++/ve+/ve+/vUgI77+977+977+9SAjvv73vv73vv73vv71/77+9fmnvv73DmVgk77+9RUJYJO+/vUVCWCRO77+9Clfvv71c77+977+9d++/vX3vv71hJhYJYe+/vRAWCWHvv70QFu+/ve+/vVvvv73vv717UWbvv73vv71w77+977+977+977+9d++/vXRMLBLvv70iISwS77+9IiEsEu+/vWsO77+9Zu+/vQTvv70UJhYJYe+/vRAWCWHvv70QFu+/vW99X2Hvv70O77+9We+/ve+/vVh5enjvv719OCYWCWHvv70QFglh77+9EBbvv73vv71bYe+/ve+/ve+/vX3vv73vv73vv70d77+9Nc+d77+9WCTvv71FQlgk77+9RUJYJFY/Qe+/vW00Yztgd++/vXgaZ++/ve+/ve+/ve+/vUgI77+977+977+9SAjvv73vv73vv73vv71m77+977+9PXMcM++/vXfvv70/Czrvv73vv70iISwS77+9IiEsEu+/vSLvv73vv73vv73vv73vv71/fzd277+977+977+977+977+9A++/vVgk77+9RUJYJO+/vUVCWCTvv73vv70V77+9bT3dru+/vXIv77+977+9ee+/ve+/ve+/vUVCWCTvv71FQlgk77+9Re+/vT3vv70rfGLvv70z77+977+9Thjvv704cE8077+9SAjvv73vv73vv71ICO+/ve+/ve+/vUh877+9We+/vRPvv70bJU7vv70z77+9QCYWCWHvv70QFglh77+9EBbvv73vv71b77+977+9ae+/vWXvv71d77+977+977+977+977+9E++/vVgk77+9RUJYJO+/vUVCWCRO77+9Clfvv7020L3PnW5/77+977+977+9IiEsEu+/vSIhLBLvv70i77+907fCuyc777+977+9Le+/vSt277+9OxPvv73vv73vv71ICO+/ve+/ve+/vUgI77+9xIlb77+977+9HWfvv73vv70RV++/vTl677+977+9NxAWCWHvv70QFglh77+92L8V77+9f++/vUp3U2jvv73vv71tPz0077+9SAjvv73vv73vv71ICO+/ve+/ve+/vUjvv71/77+9Pe+/vWRi77+9EBYJYe+/vRAWCWHvv70QFglh77+9EBYJYe+/vRAWCWHvv70QFglh77+9EBYJYe+/vRAWCWHvv70QFglh77+9EBYJYe+/vRAWCWHvv70QFglh77+9EBYJYe+/vRAWCWHvv70QFglh77+9EBYJYe+/vRAWCWHvv70QFu+/ve+/ve+/ve+/vQDvv71d77+9Ve+/vQAAAABJRU5E77+9QmDvv70=

@yamill
Copy link

yamill commented Mar 22, 2016

I'm having this same issue as well. I've been trying to figure out a solution, will get back and let you know If I do...or if anyone knows that would be great.

@hramos
Copy link
Contributor

hramos commented Apr 2, 2016

We are closing this issue due to a lack of sufficient information.

Please refer to this issue for an example of a great bug report.

You may use Server Fault for questions about managing Parse Server.

For code-level and/or implementation-related questions or technical support, please refer to Stack Overflow.

@hramos hramos closed this as completed Apr 2, 2016
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

4 participants