Return PDF from MAKE

Hello!

I want to return a pdf from Make to Glide. I’ve tried with http but it doesn’t return anything in glide. Can someone tell me what I am doing wrong?

Thanks!


What does the output bundle of your HTTP module look like?

@Darren_Murphy

Okay, so Status code 400 indicates an error.
Click at the top right and select “Download Output Bundles” - then you’ll be able to see more details of the error.

[
{
“statusCode”: 400,
“headers”: [
{
“name”: “date”,
“value”: “Fri, 29 Mar 2024 08:29:27 GMT”
},
{
“name”: “content-type”,
“value”: “text/html; charset=utf-8”
},
{
“name”: “transfer-encoding”,
“value”: “chunked”
},
{
“name”: “connection”,
“value”: “close”
},
{
“name”: “cf-ray”,
“value”: “86be7e04a94479e2-DUB”
},
{
“name”: “cf-cache-status”,
“value”: “DYNAMIC”
},
{
“name”: “access-control-allow-origin”,
“value”: “*”
},
{
“name”: “cache-control”,
“value”: “no-store”
},
{
“name”: “strict-transport-security”,
“value”: “max-age=2592000”
},
{
“name”: “content-security-policy”,
“value”: “default-src ‘none’”
},
{
“name”: “x-content-type-options”,
“value”: “nosniff”
},
{
“name”: “x-edge-cache-status”,
“value”: “MISS”
},
{
“name”: “x-edge-origin-cache-control”,
“value”: “no-store”
},
{
“name”: “x-fly-region”,
“value”: “cf-DUB”
},
{
“name”: “x-frame-options”,
“value”: “SAMEORIGIN”
},
{
“name”: “x-origin-cf-cache-status”,
“value”: “DYNAMIC”
},
{
“name”: “x-powered-by”,
“value”: “Express”
},
{
“name”: “x-robots-tag”,
“value”: “noindex”
},
{
“name”: “server”,
“value”: “cloudflare”
},
{
“name”: “alt-svc”,
“value”: “h3=":443"; ma=86400”
}
],
“cookieHeaders”: ,
“data”: “\n<html lang="en">\n\n<meta charset="utf-8">\nError\n\n\n

SyntaxError: Unexpected token } in JSON at position 298
   at JSON.parse (<anonymous>)
   at parse (/glide/node_modules/.pnpm/<a href="/cdn-cgi/l/email-protection" class="cf_email" data-cfemail="a3c1ccc7da8ed3c2d1d0c6d1e3928d91938d92">[email protected]/node_modules/body-parser/lib/types/json.js:89:19)
   at /glide/node_modules/.pnpm/<a href="/cdn-cgi/l/email-protection" class="cf_email" data-cfemail="52303d362b7f22332021372012637c60627c63">[email protected]/node_modules/body-parser/lib/read.js:128:18
   at AsyncResource.runInAsyncScope (node:async_hooks:203:9)
   at invokeCallback (/glide/node_modules/.pnpm/<a href="/cdn-cgi/l/email-protection" class="cf_email" data-cfemail="5c2e3d2b713e3338251c6e7269726d">[email protected]/node_modules/raw-body/index.js:231:16)
   at done (/glide/node_modules/.pnpm/<a href="/cdn-cgi/l/email-protection" class="cf_email" data-cfemail="671506104a0508031e275549524956">[email protected]/node_modules/raw-body/index.js:220:7)
   at IncomingMessage.onEnd (/glide/node_modules/.pnpm/<a href="/cdn-cgi/l/email-protection" class="cf_email" data-cfemail="5426352379363b302d14667a617a65">[email protected]/node_modules/raw-body/index.js:280:7)
   at IncomingMessage.emit (node:events:525:35)
   at endReadableNT (node:internal/streams/readable:1358:12)
   at processTicksAndRejections (node:internal/process/task_queues:83:21)
\n<script data-cfasync="false" src="/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js">\n\n”,
“fileSize”: 1808
}
]

Okay, your JSON is malformed.
Actually, I think I see the problem. You have an extra comma after the curly bracket with your name column value. Remove that and it will most likely work.

1 Like

Thanks! That was a problem. But now the status code is 200

[
{
“statusCode”: 200,
“headers”: [
{
“name”: “date”,
“value”: “Fri, 29 Mar 2024 09:27:30 GMT”
},
{
“name”: “content-type”,
“value”: “application/json; charset=utf-8”
},
{
“name”: “content-length”,
“value”: “4”
},
{
“name”: “connection”,
“value”: “close”
},
{
“name”: “cf-ray”,
“value”: “86bed3070e5b56d8-DUB”
},
{
“name”: “cf-cache-status”,
“value”: “DYNAMIC”
},
{
“name”: “access-control-allow-origin”,
“value”: “*”
},
{
“name”: “cache-control”,
“value”: “no-store”
},
{
“name”: “etag”,
“value”: “W/"4-TplQofIwX1bTWMrSPyggP7Oqy+8"”
},
{
“name”: “strict-transport-security”,
“value”: “max-age=2592000”
},
{
“name”: “access-control-allow-headers”,
“value”: “Content-Type,Authorization,X-Glide-Attempt,Fly-Customer-Request-Id”
},
{
“name”: “access-control-allow-methods”,
“value”: “GET,POST,OPTIONS”
},
{
“name”: “access-control-max-age”,
“value”: “3600”
},
{
“name”: “x-edge-cache-status”,
“value”: “MISS”
},
{
“name”: “x-edge-origin-cache-control”,
“value”: “no-store”
},
{
“name”: “x-fly-region”,
“value”: “cf-DUB”
},
{
“name”: “x-frame-options”,
“value”: “SAMEORIGIN”
},
{
“name”: “x-glide-deployment-version”,
“value”: “f75e5a13731973f9cbaedd39f8ffaef2c25fb163”
},
{
“name”: “x-origin-cf-cache-status”,
“value”: “DYNAMIC”
},
{
“name”: “x-powered-by”,
“value”: “Express”
},
{
“name”: “x-robots-tag”,
“value”: “noindex”
},
{
“name”: “server”,
“value”: “cloudflare”
},
{
“name”: “alt-svc”,
“value”: “h3=":443"; ma=86400”
}
],
“cookieHeaders”: ,
“data”: “[{}]”,
“fileSize”: 4
}
]

200 is what you want. Was the value in the table updated?

No. It doesn’t return anything in table

Check the input bundle of your HTTP module - make sure you’re actually sending a value.

Thanks! The value was updated in table. But it doesn’t return the pdf link. When i press on the link it shows me an error from Google (error 403). Do you know what’s from? Maybe I think I have to put another module in make (google drive-download a file) or I have to replace the value I want to return (now I have Web content link)

Depends what you want. You could try the Web View Link instead, but you also need to ensure that the permissions on the file are such that anyone with the link can view.

It works with Web View Link. Now in the app i want to show that document with web embed but it say about the google restriction. With the image component it shows the content but i wanted the web embed because a document it might have more pages and i want to scroll in the doc.

You may try this old trick.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.