30DaysPostmanDeveloper: Day 02 - There was an error in evaluating the test script: TypeError: Cannot read property 'item' of undefined

Getting this error while submitting the Request.

There was an error in evaluating the test script: TypeError: Cannot read property ‘item’ of undefined

Updated the environment properties with collection_uid, postman_api_key

It looks like the request returned a 404 response, given that information, the script wouldn’t complete as it’s looking for something in the response body.

I would check that the URL, path, ids etc are correctly resolved. You can see the full request that was sent by opening the Console.

I agree with Danny - I can replicate this problem if my collection_uid variable is set incorrectly (e.g. if it’s accidentally retaining the collection ID from your Day 1 solution). You mentioned that you’d set this as an environment variable - you won’t want to do this, because every day’s solution requires a different collection_uid value.

1 Like

I tried everything. I removed the environment variables.
I added directly to the request.
Collection ID is new one. Generated today. Still an error.

Is that the request ID in the URL or the Collection ID - I can’t see the full URL but it looks nearly the same as the one in the right side request context menu. :thinking:

Ensure it’s the Collection ID in the path and than there are no additional characters on the end of the value, sometimes that happens.

1 Like

Added full screenshot with Request with Collection ID:
No extra or additional characters found in console.

You’re adding the request ID and not the Collection ID.

1 Like

This has confirmed what Danny suggested :slight_smile: The ID that you have directly added to the request is the Request ID, not the Collection ID. (You will see that in the right-hand panel, the panel is titled “Request details”)

You can find the collection ID by clicking on the “Day 02: Collections and environments” label in the left panel, and then if you click the highlighted “Info” link it will reveal the Collection ID value.

3 Likes

Finally found the details.

I missed to see the heading “Collection Details” / “Request Details”

image

1 Like

I too see the same type of error even when I have added the collection id



Need some help on this.

My bad , I was able to figure out the issue , I had to remove the flower bracers.

3 Likes

I’m getting a different error invalid api key error.

"error": {
    "name": "AuthenticationError",
    "message": "Invalid API Key. Every request requires a valid API Key to be sent."
}

I generated api key it worked now.

can anyone help me out with this . Day 2 challenge
New request added | TypeError: Cannot read property ‘length’ of undefined
how to resolve it correctly.

Hey!

Could you double check that you have the latest changes from the parent collection forked?
There should be two requests in the “Collections and environments” folder, POST raw text and GET with query params

Your answer good for me. Thanks you

Anyone can help? ;/

@jusmur87 Have you checked if your api key is correctly set, or tried generating a new one? Looks like it may have expired.

Yes ;( I already generated Api key few times and set up and save with new key. Still same issue.

@jusmur87 I just noticed you’re not using the correct name for the header, it should be X-Api-Key and not postman-api-key.