Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fileAdapter - Google Cloud config not working #3438

Closed
mauriciord opened this issue Jan 26, 2017 · 6 comments
Closed

fileAdapter - Google Cloud config not working #3438

mauriciord opened this issue Jan 26, 2017 · 6 comments

Comments

@mauriciord
Copy link

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 ?

@natanrolnik
Copy link
Contributor

@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.

@mauriciord
Copy link
Author

@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 ?

@mauriciord
Copy link
Author

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

@mauriciord
Copy link
Author

mauriciord commented Jan 31, 2017

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.

@mauriciord
Copy link
Author

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%, 😀😀😀😀😀😀
Thanks for all.

@natanrolnik
Copy link
Contributor

Glad you figured it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants