Skip to content

S3 File adapter - accessing previous, non-s3 files #6273

@Samigos

Description

@Samigos

We have a mobile app that runs on Parse Server 2.8.4, hosted at DigitalOcean. We were using the default file adapter (GridStoreAdapter) and now we want to use Spaces by DigitalOcean. This is our updated index file:

var express = require('express');
var ParseServer = require('parse-server').ParseServer;
var ParseDashboard = require('parse-dashboard');
var path = require('path');
var S3Adapter = require('parse-server').S3Adapter;
var AWS = require("aws-sdk");

var databaseUri = process.env.DATABASE_URI || process.env.MONGODB_URI;

//Set Digital Ocean Spaces EndPoint
const spacesEndpoint = new AWS.Endpoint('fra1.digitaloceanspaces.com');
//Define S3 options
var s3Options = {
  bucket: 'bucketName',
  baseUrl: 'https://domain.com',
  region: 'fra1',
  directAccess: true,
  globalCacheControl: "public, max-age=31536000",
  s3overrides: {
    accessKeyId: 'accessKey',
    secretAccessKey: ' secretAccessKey',
    endpoint: spacesEndpoint
  }
};

var s3Adapter = new S3Adapter(s3Options);

var api = new ParseServer({
  databaseURI: databaseUri,
  appId: process.env.APP_ID,
  allowClientClassCreation: false,
  masterKey: process.env.MASTER_KEY,
  fileKey: 'fileKey',  
  serverURL: process.env.SERVER_URL,
  publicServerURL: 'http://ip/parse',
  filesAdapter: s3Adapter
});

Everything works great! The files are stored and retrieved properly, except of the old ones! Every image that was stored with the GridStoreAdapter cannot be fetched anymore! Is there anything that can be done in order to be able to view both old and new files?

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