Day 29 of 30 day Postman Challenge


I was able to pass the submission for Day 29 but the first call “Echo” has not worked. Namely, the Pre-request Script has not worked.


The code is given as:
let incomingPayload = JSON.parse(globals.previousRequest).data; pm.collectionVariables.set("newPayload", incomingPayload.message)


“There was an error in evaluating the Pre-request Script:JSONError: Unexpected token u in JSON at position 0”

I can’t for the life of me understand this error or spot how I misunderstood the instructions.

Thank you for any insight.

Hey @robo-iv :wave:

Welcome to the Postman community! :postman:

Could you share the Public link to your Workspace, please?

Hi @danny-dainton ,

this should be me. thank you

I tested further by trying console.log(pm.globals.get(‘previousRequest’)); at the beginning of the Pre Script and it is undefined. I don’t seem to understand what is expected from this step at all.

That script in the echo request relates to the functionality of the Webhook you created when it’s Triggered. It wouldn’t work in isolation or as a single request.

When you trigger the Webhook, you should see the output of this in the monitor that what created for it.

Have you submitted the collection for that day’s task? Given the items that it’s testing against, it looks to me like that Collection would pass.

I have this problem too…

I’m not really sure what the problem is here, the echo request is not intended to be run as a single request.

With the pre-request code, that’s very specific to the webhook functionality, it’s going to error.

Triggering the webhook, if that’s been created correctly, will run the Collection in the Monitor and the results of that can be seen on the monitors console.

1 Like

The challenge submission passed.

The monitor is running and “unhealthy”.

I’m not sure I’ve ever found the expected console logs - 'Echoing my payload: ', pm.response.json().data

Going back over this again, it appears somehow I was running the previous day’s (28 UI testing) collection in my monitor. I deleted the monitor, verified I had Day 29’s Collection Id as my variable and triggered a new webhook.

It is running properly now. I get that the first echo call wasn’t supposed to run on its own, I guess it was just where I started looking when my monitor wasn’t running properly.

Thanks for the help.

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