Skip to content

Parse Hooks requests have double forward slash in URL (which is an issue for Express 5.x) #2406

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

Closed
4 tasks done
pocketcolin opened this issue Jan 13, 2025 · 3 comments · Fixed by #2441
Closed
4 tasks done
Labels
state:released Released as stable version state:released-alpha Released as alpha version type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@pocketcolin
Copy link
Contributor

New Issue Checklist

Issue Description

An Express 4.x oddity allowed requests to be made with a double forward slash in the URL if it was between the router and route (discussed here). This is an anti-pattern and shouldn't be allowed. It looks like because of the way some routes are created in this SDK, a double forward slash is automatically being added to some internal requests. This requires us to make Parse Server continue supporting double forward-slashes even though it's really not advisable.

It's fairly easy to track the issue down in the code. You can see paths that start with forward slashes here:
https://github.com/parse-community/Parse-SDK-JS/blob/alpha/src/ParseHooks.ts#L77

And then the REST controller checks if the Server URL ends with a forward slash and, if it doesn't it adds one before tacking on the path:
https://github.com/parse-community/Parse-SDK-JS/blob/alpha/src/RESTController.ts#L235

Steps to reproduce

Run any call that triggers an internal REST call to Hooks or (I think) Files and observe the URL used internally. You will see something like this:

http://localhost:1337/parse//hooks/functions

I discovered this running Parse Server Hooks integration tests so that's another way to reproduce this issue.

Actual Outcome

Doubled up forward slashes.

Expected Outcome

The SDK should not be doubling up the forward slashes.

Server

  • Parse Server version: 7.4.0
    Client
  • Parse JS SDK version: 5.3.0
Copy link

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.

@mtrezza mtrezza added the type:bug Impaired feature or lacking behavior that is likely assumed label Jan 13, 2025
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 6.0.0-alpha.2

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label Feb 16, 2025
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 6.0.0

@parseplatformorg parseplatformorg added the state:released Released as stable version label Mar 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:released Released as stable version state:released-alpha Released as alpha version type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants