yellammab
(Yellamma Bheemichetty)
January 19, 2023, 12:17pm
1
Your question may already have an answer on the community forum. Please search for related topics, and then read through the guidelines before creating a new topic.
Here’s an outline with best practices for making your inquiry.
My question :
Getting this error when submitting my collection for day_01- “There was an error in evaluating the test script: TypeError: Cannot read properties of undefined (reading ‘item’)”
Details (like screenshots) :
How I found the problem :
When submitting the collection
I’ve already tried :
Regenerating the API key
Have you updated the “postman_api_key” collection variable for day 01?
You need to ensure your generated API key is in the “current” value.
You will need to do this for every day.
yellammab
(Yellamma Bheemichetty)
January 20, 2023, 3:01am
3
Yes I did update the current value with the Api key. But the error remains.
The error is telling you that it can’t find the API key.
It doesn’t appear to be an issue with the header, so its more likely that the issue is with the collection variable.
Can you share a screenshot of the collection variables? (Redacting the value as appropriate).
michaelderekjones:
postman_api_key”
You can check this by adding a line at the top of the tests tab for the submission to pull the current value of the collection variable.
console.log(pm.collectionVariables.get("postman_api_key"));
Then check the log to ensure its not coming back as “undefined”.
(Remember to remove the line of code after you get it working).
Also check that the variables starts with “PMAK-”
yellammab
(Yellamma Bheemichetty)
January 21, 2023, 12:41pm
6
Hi Jones,
I added my postman_api_key here under the current value in Collection varables
Not sure what else to recommend, apart from generating a new API key and trying again.
The other thing to check is the actual request that is being sent in the Console Log.
Check the headers and that the x-api-key is being sent in the request, and that it matches the variable.
yellammab
(Yellamma Bheemichetty)
January 22, 2023, 4:32am
8
I tried regenerating the API and adding it. But still the same thing.
How about the console log. Have a look at what is actually being sent.