Parse-server: Invalid function: hello with Docker

Created on 2 Nov 2020  路  5Comments  路  Source: parse-community/parse-server

New Issue Checklist

Issue Description


I have following this step and setting the cloud-code-vol to a local directory that contain a main.js file. I have also checked into Docker Container and found that the main.js file on my volume is already in the cloud directory inside Container. But when i try to execute the Cloud Code using the JS Console in Parse Dashboard, i get an Error below:

image

Additional Info

JS Console in Parse Dashboard

console.log(await Parse.Cloud.run("hello"))

main.js File

Parse.Cloud.define('hello', function () {
  return 'hello-world';
});

Steps to reproduce

  • Create a main.js file in the directory you will passing as cloud-code-vol to Docker Run Command.
  • Install & run Parse Server using Docker. I follow this step.
  • Install & run Parse Dashboard using Docker. I follow this step.
  • Open Parse Dashboard and go to API Console > JS Console.
  • Exec Cloud Code with Parse.Cloud.run method.

Server

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: 4.4.1
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): Local

Client

I am using Parse Dashboard with Docker. The latest digest is 152a141.

Logs

2020-11-02T11:39:42.301Z - Invalid function: "hello"
enhancement documentation

All 5 comments

Thank you for reporting.

@davimacedo Do you have any suggestion for this Docker related issue?

Can you try to run the container with the following command?

docker run --name my-parse-server -v cloud-code-vol:/parse-server/cloud -v config-vol:/parse-server/config -p 1337:1337 --link my-mongo:mongo -d parse-server --appId APPLICATION_ID --masterKey MASTER_KEY --databaseURI mongodb://mongo/test --cloud /parse-server/cloud/main.js

@davimacedo Yes it work. Thank you very much. I think you should update the Documentation for Docker regarding this problem or add default value for cloud parameter.

@lamualfa Thanks for confirming that the issue could be resolved.

Would you want to open a PR for your suggested changes?

Yes, i will create a new PR.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sanergulec picture sanergulec  路  4Comments

jaydeep82 picture jaydeep82  路  4Comments

ugo-geronimo picture ugo-geronimo  路  3Comments

mohmagdy picture mohmagdy  路  3Comments

ViolentCrumble picture ViolentCrumble  路  3Comments