i was working on the 30 day challenge.
in the 2nd day challenge I completed all the tasks but on submission it gives the error as:
There was an error in evaluating the test script: TypeError: Cannot read properties of undefined (reading ‘item’)
i was working on the 30 day challenge.
Welcome to the Postman community!
A few things that I would suggest to look at to debug this:
Which test is this related too?
Have you tried walking through the steps again in the documentation?
Are all variables saved in the initial and current values?
Do all the request names and methods match?
1.this test is for submitting solutions of the day 2 challenge of the 30 day challenge in the postman.
2.i have tried twice but i am getting the same problem again and again.
3. there are two environments declared one is the baseURL and other is the postman_api_key for baseURL we can declare the initial and current values but in the api key its written to not input the intial value and put the api key in the current value only.
4. yes , to my knowledge .
I’m not sure why you have environment files created called
postman_api_key - That should be the variable keys
The test script is asserting against data in the response body, you request is returning a 401 (I can see that from the request) so it’s not returning the correct response body.
You need to read through every step one by one and add the Authorization details to the correct place.
i did exactly what was written in the problem that was given to me.
about variable keys yes you are correct in baseURL we can do that but in the api key we cannot .
because it has to be used again and again and it send a message if i set the api key as variable and save and run it , the message pops out that api key exposed . i canot find a way out of here since i am a beginner
Can you post a link your Public Workspace, please?
I will be able to show you what might not be working here.
Is that a Public Workspace?
I wouldn’t be able to view that if it’s a link to a different type of Workspace.
no it is not it is a private workspace
the link of public is
I noticed a few things that are not quite right.
You should have a new environment file created (that would be auto created with the name
New Environment), in this file you should have 2 variables - One called
baseURL and the other called
postman_api_key. These variables are then set to the values mentioned on the documentation. Ensuring that you only place your generated postman api key, as the current value and not the initial.
Your first request in the Collection has the query params that should be in your second request, as mentioned in the documentation.
submit request is not resolving the Postman API Token variable and is not authorised. This is the reason it’s returning as a 401 response and failed the test.
postman_api_key variable key syntax is already be pre-added to the Headers section of the
submit request. It would pick up the value from the Environment file and authenticate the request, when you hit send.
i tried it but it again throwed the same error
link for work workspace
What is the error?
If the request is returning a 401 status code still, it’s related to the Postman API Token that you’re using.
Try generating a new token (following the instructions) and added it to the variable value, in the environment file.
Also, do a check of the request names to ensure that these are written as per the documentation.
i tried but it is still not working
It’s difficult for me to offer anymore guidance on this with literally telling you the answer, which defeats the purpose of the training
Working from your Collection in this Public Workspace:
The forked Collection Id and the Id that you’re submitting are not the same:
It looks like you have added the Id for the
submit request, in there instead.
The names of your requests are not as they are written in the documentation:
With those things in place, there shouldn’t be a reason why it would not work. If it’s still not working, don’t respond and say “it’s not working” without any other information of example images, as without that it’s difficult for anyone else to know what’s going on in front of you
finally i traced the probem , although i deleted the postman key and regenrated it but it still took the same api key again and again which i saw on the top right option hovering on which displays the environment quick look so i deleted it from there and the error finally disappeared ,
but sorry to say i encountered two new small errors in tests
1.Old request updated | TypeError: Cannot read properties of undefined (reading ‘name’)
2.New request added | TypeError: Cannot read properties of undefined (reading ‘name’)
i know sir it is quite awkward and irritating to you but i am new to it and i want to complete this challenge please help me , thank you
It’s probably still to do with this, as I mentioned, the test names in the documentation don’t match the names in your Collection.
On line 25, on the test script, it’s telling you the name of what it expects the request to be. Your request isn’t called that.
I’ve mentioned the same thing in the last message, the documentation is telling you what the name of that one and the other request should be.
Please read this again and change the name of both of the requests.
thank you sir actually i thought that that in document the POST is just for the HTTP but i had had to write the POST along with the name
thankyou for your cooperation sir
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.