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

fix: `Parse.Cloud.startJob` and `Parse.Push.send` not returning status ID when setting Parse Server option `directAccess: true`

Open dplewis opened this issue 1 year ago • 7 comments

Pull Request

Issue

Calling Parse.Cloud.startJob or Parse.Push.send from a Cloud Code function while directAccess is false doesn't return the status Id.

Closes: https://github.com/parse-community/parse-server/issues/8770 Related: https://github.com/parse-community/Parse-SDK-JS/pull/2033

Approach

Support status Id headers in the direct access REST Controller

Tasks

  • [x] Add tests
  • [x] Add changes to documentation (guides, repository pages, code comments)
  • [x] Add security check
  • [x] Add new Parse Error codes to Parse JS SDK

dplewis avatar Sep 27 '23 05:09 dplewis

Thanks for opening this pull request!

We would have to reuse returnStatus and that could work but getting response headers from xmlhttprequest is a nightmare. The code may looks similar but ParseServerRestController returns headers as a json, JS RestController returns headers as a single string that needs to be parsed.

dplewis avatar Sep 28 '23 05:09 dplewis

Can this PR be closed thanks to https://github.com/parse-community/Parse-SDK-JS/pull/2033?

mtrezza avatar Oct 03 '23 17:10 mtrezza

We have to wait for https://github.com/parse-community/Parse-SDK-JS/pull/2033 to be released for the test cases here to pass.

I've updated the PR to pass headers in the ParseRestController similarly to the JS RestController. The JS SDK will handle the headers.

dplewis avatar Oct 03 '23 17:10 dplewis

That's a great fix; so should be able to merge this in Nov when we'll do a stable release of the JS SDK with that fix included.

mtrezza avatar Oct 04 '23 00:10 mtrezza

Thank you @mtrezza, @dplewis and team for fixing this. Since I can use directAccess: false as a work around, I am happy to wait for the bug fix in Nov 2023.

nebitrams avatar Oct 07 '23 02:10 nebitrams

https://github.com/parse-community/Parse-SDK-JS/pull/2033 has been merged, but we cannot use the latest Parse JS SDK release in Parse Server due to https://github.com/parse-community/parse-server/issues/8818; so I believe we need fix #8818 first before we can merge this PR here.

mtrezza avatar Feb 15 '24 23:02 mtrezza

@mtrezza Tests have been updated. This is ready to merge.

dplewis avatar Apr 12 '24 16:04 dplewis

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 94.16%. Comparing base (f1469c6) to head (708d12e). Report is 6 commits behind head on alpha.

Additional details and impacted files
@@            Coverage Diff             @@
##            alpha    #8766      +/-   ##
==========================================
+ Coverage   94.13%   94.16%   +0.02%     
==========================================
  Files         186      186              
  Lines       14687    14724      +37     
==========================================
+ Hits        13826    13865      +39     
+ Misses        861      859       -2     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Apr 13 '24 22:04 codecov[bot]

🎉 This change has been released in version 7.1.0-alpha.6

parseplatformorg avatar Apr 14 '24 19:04 parseplatformorg

🎉 This change has been released in version 7.1.0-beta.1

parseplatformorg avatar Jun 30 '24 02:06 parseplatformorg

🎉 This change has been released in version 7.1.0

parseplatformorg avatar Jun 30 '24 02:06 parseplatformorg