-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Description
New Issue Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
- I can reproduce the issue with the latest version of Parse Server.
Issue Description
Given I have a Parse Server Running on a local server, port 1337 (serverUrl: "http://127.0.0.1:1337/parse"), with publicServerURL different from the serverUrl (publicServerURL: "http://somedomain.com/backend/parse")
And this server is behind a reverse proxy (Nginx) forwarding the address http://somedomain.com/backend/ to this host running parse:
location ^~ /backend/ {
proxy_pass http://parse-server-dns-name.com:1337/;
}
When, inside of a cloud function, I do a Parse.Object.saveAll() (POST /parse/batch) with the following parameters:
{
“requests”: [
{ “method”: “PUT”, “body”: { “type”: “Test2" }, “path”: “/parse/classes/Task/lVEd1AHl08" }
]
}
Then I should get the object updated, but Instead an error comes in the log
cannot route PUT /lVEd1AHl08
Related issue
This issue is probably happening because of #3042
In this line
Line 44 in 0031c5d
| const newPath = path.posix.join('/', localPath, '/', requestPath.slice(publicPath.length)); |
It tries to reconcile the difference between the 2 addresses, but it makes some confusion. In my case should route to the serverURL, but it's trying to use something different.
Environment
Server
- Parse Server version: 4.3.0
- Operating system: Linux (Docker)
- Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Local (self hosted)
Database
- System (MongoDB or Postgres): MongoDB
- Database version: v4.2.9
- Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): Local (Self Hosted)
Client
- SDK (iOS, Android, JavaScript, PHP, Unity, etc): JS SDK
- SDK version: 2.15.0
Logs
{“method”:“POST”,“url”:“/parse/batch”,“headers”:{“user-agent”:“node-XMLHttpRequest, Parse/js2.15.0 (NodeJS 12.19.0)“,”accept”:“*/*“,”content-type”:“text/plain”,“host”:“127.0.0.1:1337”,“content-length”:“241”,“connection”:“close”},“body”:{“requests”:[{“method”:“PUT”,“body”:{“type”:“Test2"},“path”:“/parse/classes/Task/lVEd1AHl08"}]}},
error: Parse error: cannot route PUT /lVEd1AHl08 {“code”:107,“stack”:“Error: cannot route PUT /lVEd1AHl08\n at PromiseRouter.tryRouteRequest (/app/node_modules/parse-server/lib/PromiseRouter.js:143:13)\n at /app/node_modules/parse-server/lib/batch.js:91:21\n at Array.map (<anonymous>)\n at /app/node_modules/parse-server/lib/batch.js:82:40\n at runMicrotasks (<anonymous>)\n at processTicksAndRejections (internal/process/task_queues.js:97:5)“}