Exception occured while validation: Unexpected token client

I have just switched an app over to request templates and I am getting this error once when validating the app.

Hi @RobAtOpinyin,

I can’t see you have added any error messages or screenshots. Could you please share the error message from the validation and the respective source code?

Oh, it’s in the title.

You might have missed changing the app client CDN URL with the appclient template. Follow step 1 of the migration guide. The required change as follows.

Change the following script from

<script src="https://static.freshdev.io/fdk/2.0/assets/fresh_client.js"></script>


<script src="{{{appclient}}}"></script>

in all the HTML files in the app and config folders.

Hi @Raviraj

I had missed that but have now changed it and I am still getting the same error

My app is only a serverless one so only needed to use this in iparams.html

Hey @RobAtOpinyin,

Can you share the app code as a zip file?

Hi @RobAtOpinyin
I wanted to bring to your attention that there was a code mistake in your implementation of FDK application. Specifically, it seems that the “async” keyword was omitted from an “await” call, which could result in unexpected behavior or errors.

File Name : config/assets/iparams.js
Method Name : getCuid
Line 902

How to resolve
Please add a async keyword in callback of Promise()

Incorrect code

function getCuid(client) {
	return new Promise((resolve, reject) => {
	 // your implementation

Correct Code

function getCuid(client) {
	return new Promise(async (resolve, reject) => {
	 // your implementation


Hi @Nadeem_Bhati

Thank you so much for taking a look at this. I knew it would be something silly I had done. :man_facepalming:

The missing async error messaging in node JS has to be the most annoying part of the platform as it always seems to give you unhelpful messages that send you in the wrong direction. This one has caught me a few times before.

Your help is much appreciated.

Hey @RobAtOpinyin,

One other recommendation about the app code, we noticed that the app code included PowerShell scripts, you could use npm packages equivalent for the same operations - uuid, btoa.

Hi @zach_jones_noel

Could you explain a bit more?

I did install npm packages and listed them as dependencies for those. I didn’t specifically create the Powershell scripts. The FDK appeared to create them automatically when you run it for the first time after installing the packages.


Hi @RobAtOpinyin,
The PowerShell scripts were autogenerated?

I see app manifest with dependencies -

"dependencies": {
    "nanoid": "3.3.4"

And the server directory has Powershell scripts for uuid and btoa. Were these packages generated when you used nanoid?

Hi @zach_jones_noel

No they were generated by the FDK when it first ran it after installing those NPM packages. The PowerShell script files are left over from when I tried something with those packages but I don’t use them anymore so they are not listed in the manifest.

Understood. Thanks for the clarity @RobAtOpinyin. If the app is not using them, I’d recommend you could delete those files.

Thanks! :slight_smile:

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