parse-community / parse-server-s3-adapter

AWS S3 file storage adapter for Parse Server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When uploading image, wrong url

opened this issue · comments

Migration went fine and all my images are located in bucket:
eg.: https://dishoftheday.s3.amazonaws.com/mfp_3dec89eThumb_btbUfnkKQS.jpg

But when I am trying to upload via javascript SDK it tries to upload to following location:
http://ec2-52-90-46-148.compute-1.amazonaws.com/parse/files/xxx.jpg

What am I missing?

My server.js:

var s3Options = {
"bucket": "dishoftheday",
"accessKey": "xxx",
"secretKey": "'xxx",
"region": 'us-east-1',
"bucketPrefix": '',
"directAccess": true,
"baseUrl": null,
"signatureVersion": 'v4',
"globalCacheControl": 'public, max-age=86400'
}

var s3Adapter = new S3Adapter(s3Options);

var api = new ParseServer({
databaseURI: "mongodb://dishoftheday:....",
cloud: "./cloud/main.js",
appId: "xxx",
masterKey: "xxx",
fileKey: "xxx",
clientKey: "xxx",
javascriptKey: "xxx",
serverURL: 'http://ec2-52-90-46-148.compute-1.amazonaws.com/parse/',
filesAdapter: s3Adapter,
push: {
ios: [{
pfx: './certs/pushDev.p12', // the path and filename to the .p12 file you exported earlier.
bundleId: 'dk.dida.dishoftheday', // The bundle identifier associated with your app
production: false // Specifies which environment to connect to: Production (if true) or Sandbox
}, {
pfx: './certs/pushProd.p12',
bundleId: 'dk.dida.dishoftheday',
production: true
}]
}
});

All uploads from the JS SDK goest to parse-server, note also that your server URL which is normal. Then parse-server will upload the file to the proper adapter, which in your case is S3