parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

Parse server crash - Cannot read property 'encodeParseObjectInCloudFunction' of undefined

Open zivchen opened this issue 2 years ago • 6 comments

New Issue Checklist

Issue Description

Parse server crash - Cannot read property 'encodeParseObjectInCloudFunction' of undefined

Steps to reproduce

I cannot send you my network body its too complex to explain, but its easy to see in the code

Actual Outcome

Parse server crash - Cannot read property 'encodeParseObjectInCloudFunction' of undefined

Expected Outcome

Not to crash

Environment

Prase server 6.3.1

FunctionsRouter.js - line 15 does not pass the config object to the parseObject function That will crash FunctionsRouter.js - line 21 config.encodeParseObjectInCloudFunction because the config is undefined in this case

Please pass config object in line 15 and maybe add config?.encodeParseObjectInCloudFunction

Thanks

zivchen avatar Oct 22 '23 11:10 zivchen

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

this thread is the only thread I can find that mentions encodeParseObjectInCloudFunction

I am encountering this error

TypeError: Cannot read properties of undefined (reading 'encodeParseObjectInCloudFunction')
    at parseObject (<project path>/parse-server/node_modules/parse-server/lib/Routers/FunctionsRouter.js:26:55)
    at <project path>/parse-server/node_modules/parse-server/lib/Routers/FunctionsRouter.js:20:14
    at Array.map (<anonymous>)
    at parseObject (<project path>/parse-server/node_modules/parse-server/lib/Routers/FunctionsRouter.js:19:16)
    at <project path>/parse-server/node_modules/parse-server/lib/Routers/FunctionsRouter.js:39:52
    at <project path>/parse-server/node_modules/lodash/lodash.js:13469:38
    at <project path>/parse-server/node_modules/lodash/lodash.js:4967:15
    at baseForOwn (<project path>/parse-server/node_modules/lodash/lodash.js:3032:24)
    at Function.mapValues (<project path>/parse-server/node_modules/lodash/lodash.js:13468:7)
    at parseParams (<project path>/parse-server/node_modules/parse-server/lib/Routers/FunctionsRouter.js:39:26)

when I try to pass and array of ParseObjects as a property for CloudCode (i.e. [Object])

As you can see on the 1st line of the error,

TypeError: Cannot read properties of undefined (reading 'encodeParseObjectInCloudFunction')

It's trying to read encodeParseObjectInCloudFunction from config from FunctionsRouter.js if I understand it correctly.

However, even when I do place encodeParseObjectInCloudFunction: true in my config and as I understand it, it's already set to true by default.

What else can I look at to fix this problem?

jaysonng avatar Mar 12 '24 16:03 jaysonng

You could debug Parse Server to see where the error is happening exactly and what the values are that are causing this.

mtrezza avatar Mar 12 '24 18:03 mtrezza

ah. I just saw that the fix for this issue is in Parse-Server 7.0 based on the linked discussion.

So does that mean this fix won't be in 6.x release?

this fix in particular: https://github.com/parse-community/parse-server/pull/8832

jaysonng avatar Mar 13 '24 11:03 jaysonng

No, we won't back port it to PS6, since it's not a security issue. We are happy to review it if you would like to open a PR though.

mtrezza avatar Mar 13 '24 16:03 mtrezza

No, we won't back port it to PS6, since it's not a security issue. We are happy to review it if you would like to open a PR though.

so when I try to do a PR to alpha branch, since the changes I'm making are already there, nothing really is getting pulled. What branch should I make a PR on and what branch should I base my new branch from?

jaysonng avatar Mar 14 '24 02:03 jaysonng

@dblythy Could you please check whether this issue is already fixed on alpha? If so, we can close this.

mtrezza avatar Jan 12 '25 14:01 mtrezza

@mtrezza it seems that it was fixed here https://github.com/parse-community/parse-server/pull/8784. Could not replicate on alpha. @jaysonng can you send replication steps on Parse Server 7+?

dblythy avatar Jan 13 '25 08:01 dblythy

Closing, as this has been fixed on alpha (Parse Server 8) and since it's not a security issue won't be backported to Parse Server 7 under our LTS policy. However, we'll be happy to review and merge a PR for Parse Server 7 if anyone wants to open one.

mtrezza avatar Jan 16 '25 18:01 mtrezza