Search code examples
node.jsgitdockerparse-server

Cannot find module '/parse/cloud/main.js' in Docker Parse Server


I am working with Docker Parse Server and I am trying to get some cloud code working.

It does work with the basic example (section "Server Side Developments" in the link given above) where my git repository just contains a main.js like so:

(root)
|
|- main.js

However, when I try to upload a Parse Example Project, I am not getting to the point that this is working. The project is structured as follows:

(root)
|
|- cloud
|  |- main.js
|
|- public
|  |- assets
|     |- ...
|
|- index.js
|- package.json
|- ...

The error I keep getting is "Error: Cannot find module '/parse/cloud/main.js'" because the main.js is not in the root folder of my uploaded project anymore, but in a subfolder "cloud". Also, it is completely ignoring the other files. My guess is that the mounting point of the git repository is at "/parse/cloud" although it should be "/parse". Any ideas how to fix that? I already added an issue for it (sorry, no more than two links aloud for me here). Thank you!

Btw.: I use docker compose to start the parse server and all its docker friends..

USER1=some_user USER1_PASSWORD=some_password PARSE_DASHBOARD_VIRTUAL_HOST=subdomain1.some_domain.com PARSE_DASHBOARD_LETSENCRYPT_HOST=subdomain1.some_domain.com PARSE_DASHBOARD_LETSENCRYPT_EMAIL=mail@some_domain.com PARSE_SERVER_VIRTUAL_HOST=subdomain2.some_domain.com PARSE_SERVER_LETSENCRYPT_HOST=subdomain2.some_domain.com PARSE_SERVER_LETSENCRYPT_EMAIL=mail@some_domain.com SERVER_URL=https://subdomain2.some_domain.com/parse PARSE_DASHBOARD_ALLOW_INSECURE_HTTP=0 APP_ID=some_id MASTER_KEY=some_master_key docker-compose -f docker-compose-le.yml up

Solution

  • Here is what I've done to get this working using the official parse-server docker image.

    docker run --name dev-parse-server --link dev-mongo:mongo -v /app:/app -p 80:1337 parseplatform/parse-server:2.2.25-beta.1 --appId betaId --masterKey foo --databaseURI mongodb://mongo/test --cloud /app/cloud/main.js

    The part that is important is to pass the full path to main.js. I also happen to use a local folder that holds my cloud code.