30 Days of Postman - Day 29

Hello,
In the challenge of Day 29, when I run the ‘echo’ request after creating and triggering the webhook, the console shows an error stating “JSONError: Unexpected token u in JSON at position 0”.
Other than that everything works fine.
Can anyone help me with this?

1 Like

Hi @jainujjawal1999,

In the screenshot, the collection runner says that the error is within the pre-request script for the request called echo. Are you able to share your pre-request script?

Hello @neilstudd ,

I have attached the screenshots of pre-request script and test script below.

The pre-request script doesn’t look quite right to me. :thinking:

You might need to go back and take a look at what the documentation says to add in there.

https://www.postman.com/postman/workspace/30-days-of-postman-for-developers/documentation/1559645-7d96fb0a-52d9-4c7e-b044-6f5c3f6ee12f?entity=folder-47d047b7-7348-47da-adf1-ec650997282d

1 Like

I have updated the pre-request script, but still it shows the same error.

Are you suppose to manually run that one or the trigger webhook request that uses that request.

Probably best to read each part of the documentation, it will guide you through each step.

I completed this scenario today using it so it definitely works :grin:

Danny is correct; you’re not supposed to trigger this particular request manually (I see the same error in my Day 29 collection if I attempt to run it directly).

There’s another clue in the error message: When you see Unexpected token u in JSON this normally means that you’re trying to do JSON.parse on a variable that does not exist (the value is literally “undefined”, so when it tries to convert this to JSON, the first character it encounters is “u”). You can see proof of this if you add console.log(globals.previousRequest) at the top of the script -

You should review the documentation for Day 29, and check that you are running the correct requests at the correct time :slightly_smiling_face:

3 Likes