PFFile无法将文件存储到Parse-server

时间:2018-03-10 13:49:20

标签: ios swift parse-server pffile parse-dashboard

Parse Dashboard版本1.1.2

解析服务器版本2.7.1

环境设置

在Ubuntu 16.4(数字海洋水滴)上运行的Parse-Dashboard

重现的步骤

  • 添加新列类型的文件
  • 通过客户端和解析仪表板上传图像现有对象
  • 加载后想象没有显示

日志/跟踪

浏览器控制台: [错误]无法加载资源:服务器响应状态为400(错误请求)(profile.jpg,第0行)---- http://myserver:1337/parse/files/profile.jpg

Parse-dashboard日志: 无法存储文件

Xcode输出: [错误]:无法存储文件。 (代码:130,版本:1.16.0)

解析服务器配置 - 例如:

var express = require('express');
var ParseServer = require('parse-server').ParseServer;
var path = require('path');

var databaseUri = process.env.DATABASE_URI || process.env.MONGODB_URI;
if (!databaseUri) {
console.log('DATABASE_URI not specified, falling back to localhost.');
}

var api = new ParseServer({
databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
cloud:'./cloud/main.js',// process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || '',
verbose: true,
masterKey: process.env.MASTER_KEY || '',
javascriptKey: process.env.JAVASCRIPT_KEY || '',
allowClientClassCreation: process.env.CLIENT_CLASS_CREATION || false,
serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse',
publicServerURL:'http://example.com:1337/parse',
push: {
},
liveQuery: {
classNames: ["", ""]
},
push: {
ios: {
   pfx: 'Push.p12',
   passphrase: '',
   bundleId: '',
   production: false
}
}
});
var app = express();

app.use('/public', express.static(path.join(__dirname, '/public')));

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 website. Please star the parse-server     repo on GitHub!');
});

var port = process.env.PORT || 1337;
var httpServer = require('http').createServer(app);
httpServer.listen(port, function() {
console.log('parse-server-example running on port ' + port + '.');
});

ParseServer.createLiveQueryServer(httpServer);

1 个答案:

答案 0 :(得分:0)

如果您尝试从信息中心上传图片,则需要在信息中心配置(parse-dashboard-config.json)中添加javascript密钥。