Skip to content

I can not use any third lib in CloudCode. #6055

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

Closed
fuqiangZ opened this issue Sep 17, 2019 · 3 comments
Closed

I can not use any third lib in CloudCode. #6055

fuqiangZ opened this issue Sep 17, 2019 · 3 comments

Comments

@fuqiangZ
Copy link

fuqiangZ commented Sep 17, 2019

[Questions]
I want to use third libraries in my cloud code of parse-server. I installed the dependencies in parse-server already, But when i use it in cloud code, error occurs as can not found the module.

[reproduced]
eg: I tryied to use mailgun in my CloudCode.

  1. install lib in parse-server,

npm install mailgun-js --save
check the package.json, "mailgun-js": "^0.22.0", exists

  1. require mailgun in cloudcode
var mailgun = require('mailgun-js')({apiKey: 'XXX', domain: 'XXX.com'});
Parse.Cloud.define("sendMail", (request, response) => {
});
  1. start the parse-server. Then error occurs:
Error: Cannot find module 'mailgun-js'
Require stack:
- /dilu_dev/gitlab/metis-cloudcode/okr/test.js
  • Server
    • parse-server : 3.7.2
    • Operating System: MacOS 13
    • Hardware: Mac
    • Localhost or remote server? : Local parse-server
@davimacedo
Copy link
Member

Can you please fill out the issue template? https://github.com/parse-community/parse-server/issues/new/choose

@fuqiangZ
Copy link
Author

Can you please fill out the issue template? https://github.com/parse-community/parse-server/issues/new/choose

well, i maybe know why.
I git clone the source code and run lib/cli/parse-server.js directly. Besides i add dependency lib into the parse-server’s package.json。With this way, i can not require lib in the cloud code.
But, i download the parse-server-example, then add dependency to the package.json, then reuqire the lib in the cloud code, it works...Ohh

Am i right ? I'm new to parse-server.

@fuqiangZ
Copy link
Author

well, solved again..... If i put the cloudcode dir out of the parse-server dir, then can not use these libs. But, put the cloudCode dir in the parse-server dir , it works.... That...

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