Skip to main content
Answer

Unable to add ‘await’. Get the editor error Missing “;” before statement. on line 16

  • January 6, 2024
  • 4 replies
  • 160 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};

 

Best answer by connorz

Hi @amarunda , 

It sounds like you’re using the developer platform’s UI, correct? If so, this might be related to a bug in the linter used by that code editor. 

Have you tried testing the code regardless of the missing semicolon error? Barring actual issues, if linting is responsible, the code should still execute.

If the code works despite the error, you can hide the error using the linter’s ignore directive.

I hope that helps, but please feel free to reach out Platform Support team with any questions: https://developer.zapier.com/contact

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

4 replies

raydeck
Forum|alt.badge.img+1
  • New
  • January 6, 2024

Can you share where you’re implementing this code? stashfile is promise-based, but maybe the answer is in the context of what you’re up to. As an aside, you will probably need to await the z.request call too when the time comes. 


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

I’m implementing this code as an Action on the Developer platform. I try to add the ‘await’ as seen above on line 16, but get a editor error Missing “;” before statement. But all relevant documentation states I should add an ‘await’, so I’m am confused as to why the Developer platform code editor is throwing this error. The await seems necessary as the binary file requested gets truncated/corrupted without it.


raydeck
Forum|alt.badge.img+1
  • New
  • January 7, 2024

In order to help I need a little more context. Maybe you could record a loom of the situation and triggering the error? I don’t know if you’re using the CLI, the developer interface, or where the code is getting applied. Showing in a vid can be a really fast way to deliver a lot of information without having to explain a lot. 


Forum|alt.badge.img+7
  • Zapier Staff
  • Answer
  • January 8, 2024

Hi @amarunda , 

It sounds like you’re using the developer platform’s UI, correct? If so, this might be related to a bug in the linter used by that code editor. 

Have you tried testing the code regardless of the missing semicolon error? Barring actual issues, if linting is responsible, the code should still execute.

If the code works despite the error, you can hide the error using the linter’s ignore directive.

I hope that helps, but please feel free to reach out Platform Support team with any questions: https://developer.zapier.com/contact