URL in module communication is not encoding properly

Curious if anyone else has found a solution here-

We’re building our custom app and adding our file create module.

We have 2 calls to make in this module, the first being to our API where an s3 presigned URL is returned in the response. Then, a second call is made as a PUT request to the s3 URL.

We’re following the guidance in these docs: Action modules - Make Apps

The first call works as expected, but when making the 2nd call from the URL returned in the 1st response, the URL is encoded twice and will not work.

The original URL uses %3A to encode a colon, which is expected. It looks like the % symbol is being encoded itself when making the 2nd call, %25 is the encoding for the % symbol, so the 2nd URL being called is showing %253A instead of %3A.

We’ve tried using the built-in IML functions encodeURL() and decodeURL() as well as toString(), but none return the correct URL for this 2nd call.

We’re not concerned with the rest of the module yet, but we found this encoding issue and need some help. We’ve reached out to support as well but wanted to see if anyone else has experienced this issue.

Explore their “types”. You can add “urlencoded” into the request, response, etc. Or just do a custom IML function on the parameter.

1 Like

@api-guy Unfortunately this did not work. We’ve tried the built-in URL functions, and even wrote a custom function to regex the url to remove the additional encoding, but nothing works. Regardless of the functions used on the response url or the request url, when making the call, Make always re-encodes it when making the call. Our entire engineering team has looked at this and no one has been able to find a solution, everyone agrees this is something behind the scenes that Make is doing to this URL, may even be a bug? But thank you for your response!

@api-guy while the urlencoded type and functions didn’t work, there is another boolean property you can add to the request, encodeUrl - when adding this and setting to false, it WORKS. Thank you so much for pointing us in the right direction!!!

No problem. I ran the encoding issue when trying to send form data www urlencoded as content-type. It didn’t want to go until I also set the “type” on the request. Quirky.


Update with full solution:

Set encodeURL: {{false}} on request to s3 presigned URL.

This will give the correct URL, but then decode the query params completely- encoding is needed in the presigned URL params.

Solution was to write 2 functions.

First, split the URL before the “?” and then concatenate a “?” at the end. Return this string.

2nd function splits the URL after the “?” and returns all of the AWS params as-is.

Then, in the url field of the module request, get the first part and then run encodeURL() on the 2nd part.

IML parseResponse:

function parseResponse(parameters) {
    let url = parameters.toString()
	let slice = url.slice(0, url.indexOf('?'))
    let withQ = slice.concat("?")
    return withQ

IML parseParams:

function parseParams(parameters) {
    let url = parameters.toString()
    let parts = url.split("?")
    let end = parts[1]
    return end
1 Like

Hi @Allene_Norton :wave:

Awesome that you managed to figure this out! :muscle: Also, thank you very much for getting back to the topic and for sharing your solution with us. The community truly appreciates that :pray:

1 Like

Thanks! And thanks to @api-guy for pointing me to the right docs too

1 Like