-
-
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
Can't save new objects in CloudCode triggers when directAccess=true using Postgres #7714
Comments
Thanks for opening this issue!
|
Could you please open a PR with a failing test to demonstrate the issue? The test should not have any DB type exclusion, i.e. it should be for Postgres and MongoDB. This looks like a major issue that we should fix urgently before 5.0 release. |
It seems this was a false alarm as there was a deprecation warning related to promises the server was giving me pre-alpha 3 that I was missing. My guess is, beginning ~alpha-2/3 the warning switched to throwing an error which is what began crashing my server. I simply removed my code that created the warning in the first place. Sorry about this... Related to PR 7593, I did find some minor issues with the placement of the test case (it's placed in an sendEmail test along with some incorrect variable names that are probably left over from a copy/paste in the DatabaseController. I'll submit a PR to clean up the code shortly. |
@dplewis @mtrezza So I think I'm closer to where the issue actually is. It's related to the changes in I haven’t tried it yet, but I think this can be replicated by turning on directAcess in the CloudCode.spec. I’m thinking a number of tests will fail when directAccess is enabled. The remedy is to set |
Can you please open a new issue for this? It sounds quite different to what you described originally which you said was a "false alarm". It sounds like a bug with at least high severity. I'll go ahead and close this issue. |
It’s the same exact issue as I originally described. The false alarm was blaming the PR I originally blamed. Everything I reported is still the same, it occurs when directAccess=true. So it doesn’t make sense to open a different issue |
I see that you have edited your issue description instead of creating a new one, I will open this issue again. |
New Issue Checklist
Issue Description
#6636 sets
directAccess=true
by default and seems to have introduced a breaking change that is prevalent saving a new object in a afterFind trigger using the masterKey on postgres. When I add a row in the Dashboard with alpha.3, I have the same issue.I've tracked it to this PR 7593 and it's related issue #7579.5.0.0-alpha.1
works for me,5.0.0-alpha.2
I haven't tested yet, but it only adds a GraphQL change which I'm not using. Leaving PR 7597 in which my servers don't work anymore for5.0.0-alpha.3
. I've also tested beta.3 and the issue is still there.Note, this completely crashes the server. Basically, when
directAccess=true
it can crash postgres in cloud code functions when saving a new object in cloud code (mongo works and the logs above are still relevant).This issue doesn't occur on my deployed servers that are reversed proxied and have an actual public URL.My initial thinking is useMasterKey may not be passed as I see the issue when triggering afterFind when clicking on a Parse class in the dashboard. This still needs some more investigation.I'm using the Swift SDK, but Query.and is implemented like the rest of the Client SDKs, so this a major breaking change. In addition, skimming the additions in this PR, I highly doubt the server wasn't handling $and before this PR. If I remove the code that uses triggers (see logs below), none of my client side queries work correctly because of the additions in 7593.I'm using https://github.com/Blackburn-Labs/parse-auditor/ which audits and uses the CloudCode afterFind here: https://github.com/Blackburn-Labs/parse-auditor/blob/fc546406414b9408e8c84cb3dd20125fdc57753d/src/index.js#L69-L74. This has worked for earlier versions of ParseServer < 4.4.0 all the way up to alpha.1 (I didn't test 2).
Problem occurs on Postgres, seems to be working on Mongo.
Steps to reproduce
Login with a user and perform queries afterFind.
I'm still looking into how to replicate the problem as a test case.
Actual Outcome
Server crashes with the logs below.
It seems, the change in the linked PR causes the a problem around here:
parse-server/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js
Line 1327 in 2602904
Expected Outcome
No crashing when
directAccess=true
and for the new object created in the trigger to be saved to the server.Environment
Server
Database
Client
Workaround
Set
directAccess=false
when configuring your server.Logs
Enabling verbose and using Postgres:
The text was updated successfully, but these errors were encountered: