Parse-server: fileAdapter - Google Cloud config not working

Created on 26 Jan 2017  路  6Comments  路  Source: parse-community/parse-server

I'm trying to config my fileAdapter for Google Cloud Storage.
I'm using Bitnami with Google Cloud Platform. I've tried with .json and .p12 files, but not working.
Trying to upload directly from Parse Dashboard, but 400 Bad Request.

kapture 2017-01-26 at 18 25 31

I'm using as an instance:

// ...
const GCSAdapter = require('parse-server-gcs-adapter');

const gcsAdapter = new GCSAdapter(
    'xxxxxxxxxxxx', 
    '/opt/bitnami/apps/parse/htdocs/xxxxx.json', 
    'xxxxxxxxxxxx', {
        bucketPrefix: '',
        directAccess: true
    }
);

const api = new ParseServer({
    databaseURI: 'mongodb://xxxxxxxxx',
    cloud: './node_modules/parse-server/lib/cloud-code/Parse.Cloud.js',
    appId: 'xxxxx',
    masterKey: 'xxxxxxx',
    fileKey: 'xxxxxxxx',
    serverURL: 'https://thoc.com.br/parse',
    filesAdapter: gcsAdapter
});
// ...

What can i do ?

Most helpful comment

It was a Bitnami permission folder, working perfectly now.
Thanks for all

My GcsAdapter working now, this is how i made:

cd /opt/bitnami/apps/parse
sudo mkdir .config
sudo chown bitnami:daemon -R .config
sudo chmod g+rwx .config

Now it's working 100%, :grinning::grinning::grinning::grinning::grinning::grinning:
Thanks for all.

All 6 comments

@mauriciord my two cents here, maybe it can help you debugging it:

1 - Are you able to read and print to the console the json file?
2 - Can you run the server with VERBOSE=1 and see the logs?
3 - If you try to upload a file via curl, does it succeed or also fails?

Also, not related to the storage adapter, your cloud parameter when initializing ParseServer is wrong. It shouldn't be Parse.Cloud.js from the SDK, but the entry point of your cloud code (for example, a main.js file where you add the functions to. Check the Parse Server example.

@NatanRolnik it's something with Bitnami, because i used parse-file-utils today on my local machine to migrate all images for the Google Cloud Storage and worked perfectly.
Is it possible to be something with Bitnami ?

@NatanRolnik if i try to post a file via POSTMAN it's shows me a 502 Bad Gateway

The server.js is configured with gcsAdapter and see the error:

screen shot 2017-01-31 at 14 50 25

why i cannot store the file ?

{
  "code": 130,
  "error": "Could not store file: Error: EACCES: permission denied, mkdir '/opt/bitnami/apps/parse/.config'"
}

If i change to fsAdapter, it works successfully, but not with gcsAdapter.

It was a Bitnami permission folder, working perfectly now.
Thanks for all

My GcsAdapter working now, this is how i made:

cd /opt/bitnami/apps/parse
sudo mkdir .config
sudo chown bitnami:daemon -R .config
sudo chmod g+rwx .config

Now it's working 100%, :grinning::grinning::grinning::grinning::grinning::grinning:
Thanks for all.

Glad you figured it out!

Was this page helpful?
0 / 5 - 0 ratings