Skip to main content
Question

Get PDF binary file with z.stashFile

  • January 6, 2024
  • 3 replies
  • 247 views

amarunda
Forum|alt.badge.img

Unable to add ‘await’. Get the editor error Missing “;” before statement. on line 16.
Without the await the code executes but the binary file arrives corrupted due to truncating. Why cant I add the await syntax to line 16?

const encodedToken = Buffer.from(bundle.authData.api_key, 'ascii').toString('base64');

const fileRequest = z.request({
url: 'https://app.useanvil.com/api/v1/generate-pdf',
raw: true,
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Basic ${encodedToken}`
},
body: {
'data':bundle.inputData.template
}
});

const file = await z.stashFile(fileRequest);

return {file};

 

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • January 6, 2024

Hi @amarunda 

If you are building a Zap app integration, then you should post your topic in the Developer Zone: https://community.zapier.com/p/developer-zone


amarunda
Forum|alt.badge.img
  • Author
  • Beginner
  • January 6, 2024

ok noted


Forum|alt.badge.img

This might work.

const file = await(z.stashFile(fileRequest));