I wrote functions in Async/Await manner for ticket sidebar app. When I tried to pack the app it throws me an error saying
Parsing error: Unexpected token function. In Freshworks Huddle Q&A I received a response saying Async/Await is supported in FDK. Does FDK support Async/Await?
I have used the async await feature in the latest fdk. But it is supported in the server.js file(node) .
fdk uses lint. I believe it might throw an error when using async await in the app.js files.
Async/Await functionality is supported only in serverless component of the app. For frontend component, it is not supported
This has already been given as feedback in this topic.
I tried to use an async function in my current project, but it seems FDK doesn’t support async/await - “fdk pack” returns an “Unexpected token function” error. I have no problem running the app locally. Using async function helps greatly with throttling requests and performing sequential operations, so can we expect support for this in the later versions of FDK?
Keep an eye on this topic and another on our forum announcements for future support on frontend component of the FDK.
I would also like to join in the request for async/await pattern. I come from a C# background where it is the preferred pattern and working with promises is total garbage especially with the 5 callback limit.
Thanks all for the awesome responses. Eagerly waiting for Async/Await in frontend. It will definitely change how we develop frontend apps.
I too have run into this. I spent 2 days writing an app and then found when it won’t work when I run fdk pack.
Like Nick above, I really DO NOT want to author in the nested promise callback pattern - its really hard to follow. Async away is far more comprehensible.
Its interesting that it works just fine when authoring locally (with ?dev=true on our freshworks-crm site).
It would be nice to have some ETA on when we can hope to have this supported. I need to decide if I’m going to go thru the headache of rewriting my code - uggh!!
Letting y’all know that async/await syntax is now supported using
fdk 7. See the migration guide for existing apps for further details.