Skip to content

cloud code name cannot contain dot (.) #5138

Closed

Description

@meepeek

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

Activity

  1. JacobJT commented on Oct 23, 2018

    @JacobJT

    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.

  2. flovilmart commented on Oct 23, 2018

    @flovilmart
    Contributor

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

  3. AtomicSimon commented on Apr 11, 2019

    @AtomicSimon

    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.

  4. acinader commented on Apr 11, 2019

    @acinader
    Contributor

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

  5. Simone-cogno commented on Oct 29, 2019

    @Simone-cogno

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

  6. sadortun commented on Feb 10, 2021

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

  7. mtrezza commented on Feb 10, 2021

    @mtrezza
    Member

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions