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

cloud code name cannot contain dot (.) #5138

Closed
2 tasks done
meepeek opened this issue Oct 23, 2018 · 7 comments
Closed
2 tasks done

cloud code name cannot contain dot (.) #5138

meepeek opened this issue Oct 23, 2018 · 7 comments

Comments

@meepeek
Copy link

meepeek commented Oct 23, 2018

Before opening the issue please ensure that you have:

Issue Description

naming cloud function including dot '.' produce error

Steps to reproduce

adding this line in cloud, main.js

// cloud/main.js
Parse.Cloud.define('customer.create', async (req) => {})

Expected Results

success without error

Actual Outcome

/Users/thee/Desktop/parse-base-system/services/data-server/node_modules/parse-server/lib/triggers.js:111
  store[lastComponent] = handler;
                       ^

TypeError: Cannot set property '[object Array]' of undefined
    at add (/Users/thee/Desktop/parse-base-system/services/data-server/node_modules/parse-server/lib/triggers.js:111:24)
    at Object.addFunction (/Users/thee/Desktop/parse-base-system/services/data-server/node_modules/parse-server/lib/triggers.js:127:3)
    at Object.ParseCloud.define (/Users/thee/Desktop/parse-base-system/services/data-server/node_modules/parse-server/lib/cloud-code/Parse.Cloud.js:42:12)
    at Object.<anonymous> (/Users/thee/Desktop/parse-base-system/services/data-server/cloud/main.js:36:13)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at new ParseServer (/Users/thee/Desktop/parse-base-system/services/data-server/node_modules/parse-server/lib/ParseServer.js:145:9)
    at Function.start (/Users/thee/Desktop/parse-base-system/services/data-server/node_modules/parse-server/lib/ParseServer.js:296:25)
    at start (/Users/thee/Desktop/parse-base-system/services/data-server/node_modules/parse-server/lib/cli/parse-server.js:84:22)
    at _default (/Users/thee/Desktop/parse-base-system/services/data-server/node_modules/parse-server/lib/cli/utils/runner.js:57:3)
    at Object.<anonymous> (/Users/thee/Desktop/parse-base-system/services/data-server/node_modules/parse-server/lib/cli/parse-server.js:38:21)

Environment Setup

  • Server

    • parse-server version (Be specific! Don't say 'latest'.) : 3.1.0
    • Operating System: OSX Heigh Sierra
    • Hardware: MacBook Air 2012
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): localhost
  • Database

    • MongoDB version: [FILL THIS OUT]
    • Storage engine: [FILL THIS OUT]
    • Hardware: [FILL THIS OUT]
    • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): [FILL THIS OUT]

Logs/Trace

@JacobJT
Copy link

JacobJT commented Oct 23, 2018

I don't think you're intended to be able to. Keep in mind that cloud code functions are hit via REST API with something like <YourURL>/functions/functionName

So, the . would not be appropriate to use. I wonder, though, if a / instead would work? I'm not sure how parse-server would handle that routing, but it is worth a try.

@flovilmart
Copy link
Contributor

Working as expected. Cloud functions names should not include such characters. We should be probably more explicit.

@AtomicSimon
Copy link

This wasn't the case in 2.8.4, could it be added to the list of breaking changes for 3.0.0?
It took me nearly a day to figure out why my code wasn't working on the new version and I'd like to avoid the pain to other people.

@acinader
Copy link
Contributor

Would you be willing to open a pull request to address the documentation?

@Simone-cogno
Copy link

This should be added to the breaking changes. Dot notation was very useful to specify modules names for example. For chance i found this post otherwise I had to spent a lot of time. At least it should be shown an error like "no special characters allowed in cloud function names".

@sadortun
Copy link
Contributor

@acinader @Simone-cogno was this actually resolved?

Seems like there is no clear indication in the docs.

Also, would it be possible to add support for either . or / ?

If so, please reopen and I'll try to submit a PR

@mtrezza
Copy link
Member

mtrezza commented Feb 10, 2021

Thanks for picking this up.

Since this is over 2 years old and we have a new template for this, if you want to propose this enhancement and work on a PR, please open a new issue and reference this issue.

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

8 participants