Bubble encoding url twice before sending a query param to backend

Hello, I have an app where the front is on Bubble and most of the backend is done with code.
All the connexions between bubble and code are made via custom API routes.

For some reason, since yesterday, the query param I am sending for one of my API GET routes is being encoded twice. (I haven’t changed anything on my app that could affect this). Do you know what this is about ?

here is a screen between the URL encoded when testing with a swagger (first console.log) and the url encoded when testing from bubble (second console.log)

Swagger → /closure/1719211203578x132178556375007230/jobs?filters=%5B%7B%22field%22%3A%22job_type%22%2C%20%22operator%22%3A%22eq%22%2C%20%22value%22%3A%22Ponctuelle%22%7D%5D

Bubble → /closure/1719211203578x132178556375007230/jobs?filters=%255B%257B%2522field%2522%253A%2522job_type%2522%252C%2522operator%2522%253A%2522eq%2522%252C%2522value%2522%253A%2522Ponctuelle%2522%257D%255D

Could be possible your code is encoding things…so Bubble does it first by default as they do and then your code encodes it a second time?

Could these have been changed in some way that could cause the 2nd encoding to take place?

Can see in your screen shot the use of encodeURI twice for the Bubble example.

yeah that is the weird thing… I haven’t changed anything in my API route nor in Bubble… And somehow Bubble encodes it twice …

I don’t think Bubble is encoding it twice. I think Bubble does it once and then your code does it a second time. The reason I believe this is that in your screen shot showing just the code that is being tested in Swagger it shows (econdodeURI(JSON.stringify( which comes after the (encodeURI shown the screen shot for the Bubble example. My thought here is that Bubble does the first encodeURI and your code does the second.

BTW, Bubble support likely will not be able to assist on this as you are using custom code and APIs, both of which Bubble support do not lend assistance on.

I’d say a quick test would work, by removing the encode URI from your code and see if that fixes it.

3 Likes

This topic was automatically closed after 14 days. New replies are no longer allowed.