You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to save a image in my S3 service but I get an error... The files are saved in the same way that I save regular files in parse?
The code to save my image is:
var parseFile = new Parse.File(file.name, file);
'parseFile.save().then(function() {
debug_log("Saved");
var currentUser = Parse.User.current();
currentUser.set("image", parseFile);
currentUser.save();
}, function(error) {
debug_log("ERROR: " + JSON.stringify(error));
// I get this error
});
And my index.js looks like:
var express = require('express');
var ParseServer = require('parse-server').ParseServer;
var S3Adapter = require('parse-server').S3Adapter;
var databaseUri = 'xxxxxx';
if (!databaseUri) {
console.log('DATABASE_URI not specified, falling back to localhost.');
}
var api = new ParseServer({
databaseURI: 'xxxxxx',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: 'xxxxx',
masterKey: 'xxxxxx', //Add your master key here. Keep it secret!
serverURL: 'http://localhost:1338/parse', // Don't forget to change to https if needed
filesAdapter: new S3Adapter(
"xxxx",
"xxxxx",
{bucket: "xxxx", directAccess: true}
),
fileKey: 'xxxxx'
});
var app = express();
var mountPath = process.env.PARSE_MOUNT || '/parse';
app.use(mountPath, api);
app.get('/', function(req, res) {
res.status(200).send('I dream of being a web site.');
});
var port = 1338;
app.listen(port, function() {
console.log('parse-server-example running on port ' + port + '.');
});
@flovilmart Thanks! Now I can see all the debug but when I try to save the file I don't get any message from the server. Because the error happen in this part:
_
var parseFile = new Parse.File("file.name", file);
parseFile.save().then(function() {
when you call parseFile.save() this should send a request to the server. If you don't see a request coming out, that means that this is a client SDK problem.
@flovilmart I think is a problem with the parse-server configuration. I try to upload a image with the dashboard and don't work. And I don't get any log from the server!
Thanks! @flovilmart! I solve the problem with the dashboard but the problem with my app continues 😔
I don't know what can be! If I remove the S3Adapter and manage files with Parse works! But not with my S3 bucket from javascript!
Not really, as we don,t see the requests coming into parse-server, it sure seems to be a client related problem IMHO, maybe someone else's got an idea. @peterdotjs ?
@peterdotjs I was trying uploading the image directly but does not receive any response of the server. Now I try uploading the image with Base64 encoding and I get this:
your base64 string should not have data:image/jpeg;base64, just the string. I believe you're capturing that from and somewhere as HTML/cordova requires this information to properly render that image.
Activity
flovilmart commentedon Mar 11, 2016
What is the error?
ckarmy commentedon Mar 11, 2016
@flovilmart I get a empty message when I debug
JSON.stringify(error)flovilmart commentedon Mar 11, 2016
What is you file variable? a buffer? Is that in node? JS SDK?
ckarmy commentedon Mar 11, 2016
@flovilmart the file is a image that I take with my phone. This code work fine with oficial Parse storage. I don't know if I need to do something more to config my S3Adapter... I follow this instructions: https://github.com/ParsePlatform/parse-server/wiki/Storing-Files-in-AWS-S3
flovilmart commentedon Mar 11, 2016
Can you start your server with VERBOSE=1 so I can get the logs?
ckarmy commentedon Mar 11, 2016
@flovilmart Sorry I'm a beginner in this. How I start the server with
VERBOSE=1? withnpm run start VERBOSE=1? And how I see the log?Thanks!
flovilmart commentedon Mar 11, 2016
@ckarmy the opposite :
VERBOSE=1 npm startckarmy commentedon Mar 11, 2016
@flovilmart Thanks! Now I can see all the debug but when I try to save the file I don't get any message from the server. Because the error happen in this part:
_
var parseFile = new Parse.File("file.name", file);
parseFile.save().then(function() {
I don't know what to do :(
flovilmart commentedon Mar 11, 2016
when you call parseFile.save() this should send a request to the server. If you don't see a request coming out, that means that this is a client SDK problem.
ckarmy commentedon Mar 11, 2016
@flovilmart I think is a problem with the parse-server configuration. I try to upload a image with the dashboard and don't work. And I don't get any log from the server!
I try with this button:

What can be?
flovilmart commentedon Mar 11, 2016
Looks a lot like: #876, parse-community/parse-dashboard#90
ckarmy commentedon Mar 11, 2016
Thanks! @flovilmart! I solve the problem with the dashboard but the problem with my app continues 😔
I don't know what can be! If I remove the S3Adapter and manage files with Parse works! But not with my S3 bucket from javascript!
flovilmart commentedon Mar 11, 2016
how did you solve the problem with the dashboard?
ckarmy commentedon Mar 11, 2016
@flovilmart I update my parse-server and parse-server-dashboard repository.
Any idea how can I solve the problem?
flovilmart commentedon Mar 11, 2016
Not really, as we don,t see the requests coming into parse-server, it sure seems to be a client related problem IMHO, maybe someone else's got an idea. @peterdotjs ?
peterdotjs commentedon Mar 11, 2016
@ckarmy could you take a screenshot of the network requests when you are attempting to upload?
ckarmy commentedon Mar 12, 2016
@peterdotjs I was trying uploading the image directly but does not receive any response of the server. Now I try uploading the image with Base64 encoding and I get this:

The encode image is:
data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wAARCAFAALQDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD9U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ere as HTML/cordova requires this information to properly render that image.
data:image/jpeg;base64,just the string. I believe you're capturing that from and