Skip to content

Error when Save file in Amazon S3  #976

@ckarmy

Description

@ckarmy

Hi,

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 + '.');
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions