-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Parse server throws an error when saving an object with a pointer field set to undefined (Postgres only) #9146
Comments
Thanks for opening this issue!
|
made a pr to try and make a failing test case. is there a proper way to run the tests with postgres locally? i see mongodb-runner runs when i try |
Install Postgres via docker: https://github.com/parse-community/parse-server/blob/alpha/CONTRIBUTING.md#postgres-with-docker Run tests: https://github.com/parse-community/parse-server/blob/alpha/CONTRIBUTING.md#test-against-postgres |
ah i completely missed this, gonna try this out thank you!
|
Sorry haven't had much time to get back to this. I got the postgres tests working locally but I can't seem to reproduce my issue in a failing test. I was at least able to try and make a repo with a branch where i'm encountering the issue. I thought I may have been using the wrong postgres image sorry closed the issue by accident |
New Issue Checklist
Issue Description
For Parse server connected to a postgres db, if an object has a Pointer field and that field is set to undefined and saved Parse server will error with
TypeError: Cannot read properties of undefined (reading 'objectId')
The full error which I've put below leads to this line in the parse server code
parse-server/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js
Line 1385 in 09ead54
some additional context to the code
It appears that maybe
object[fieldName])
needs an if check as it does in the Date case?Also looking further up
parse-server/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js
Line 1327 in 09ead54
It looks like this createObject function in the Postgres adapter does check and skip values that are
null
. Switching the value tonull
instead ofundefined
does save without error.Steps to reproduce
Actual Outcome
Saving the object with an undefined pointer field results in:
Expected Outcome
The object should be able to set a pointer to undefined and save without throwing as it does when connected to a mongo database
Environment
Server
6.5.6
macOS Somona 14.3
Local
Database
Postgres
postgres:16.3-alpine
Local
Client
N/A
N/A
Logs
The text was updated successfully, but these errors were encountered: