Fixing frequent Zapier errors
Download URL expired
If you get an expired Download URL error during the building of your Zap, try reloading the example record in your trigger.
Since the Download URL is only valid for 1h, you need to refresh the Documents in Zapier to get new Download URL. You can do so by clicking the Load More button in the Test section of your trigger.

422 Responses
This error will usually happen if you use the custom JSON option to write your Zap but have values that need escaping before being sent to PDFMonkey.
Values containing double quotes
Let's say you defined the following custom JSON:
{
"user": {
"name": "(Dynamic Field From Zapier)"
}
}
If the value in Dynamic Field From Zapier
contains quotes, the constructed JSON will end-up broken. Let's take Peter "Spiderman" Parker
as an example. Here is what the end JSON would look like:
{
"user": {
"name": "Peter "Spiderman" Parker"
}
}
As we can see, it will not be a valid JSON payload when it's sent over the wire.
What you actually want is to escape those double quotes so that your JSON remains valid:
{
"user": {
"name": "Peter \"Spiderman\" Parker"
}
}
Values containing line breaks
JSON doesn't support values that include line breaks, so this is invalid JSON:
{
"userBio": "Once upon a time,
They lived happily ever after."
}
What you want to do instead is escape those line breaks by either replacing them with a <br>
tag or transform them to the text representation of a line break (\n
).
{
"userBio": "Once upon a time,\nThey lived happily ever after."
}
Solution
If you can't escape the values before they reach Zapier, the next best solution is to add a Code by Zapier action before calling PDFMonkey.
Let's say you data contain both line breaks and double quotes and are looking like this:
Trigger App User Bio
This is the bio of the user.
It's a free form text that the user can edit so it can contain line breaks.
It could even be split in a few paragraphs… why not?
Trigger App User Name
Peter Parker
Trigger App User Full Name
Peter "Spiderman" Parker
Here we need to escape values for both Trigger App User Bio
and Trigger App User Full Name
. Let's start by adding a Code by Zapier action to our Zap and selecting Run Javascript :

We can now give our fields names that will help us identify them in the following steps:

And now we'll add the magic that will solve our issue, the actual code:
let data = Object.assign({}, inputData);
for (let key in data) {
if (typeof(data[key]) === "string" && data[key].length > 0) {
data[key] = data[key].replace(/\r?\n/g, '<br>').replace(/\t/g, " ").replace(/"/g, '\\\"');
}
}
output = [data];
It will give you the same fields in the output but with their value properly escaped:

You can now use those values when building your PDFMonkey payload.

Notice how here we used the fields coming from the second step and not from the trigger.
Last updated
Was this helpful?