15 days of Postman - Day 4 TypeError in test : Cannot read properties of undefined (reading 'name')

So, all tests for Day 4 are passed, except the 4th one. Got TypeError: Cannot read properties of undefined (reading ‘name’). It looks like everything is ok with the names of requests. Added link to collection. Can’t find explanation anywhere, how the test script got undefined instead of request name.

Hey @science-participant2 :wave:

Welcome to the Postman Community! :postman:

For some reason, your link to the Collection doesn’t show the documentation and instructions for solving the challenge, i’ve added these below.

Please work through these one by one and see if this helps you with the challenge. If you’re still facing issues, please share more details of the issues and include screenshots of the relevant areas.

It’s time to work on your next challenge.

The Postman API lets you programmatically access data stored in your Postman account. This API requires an API key to tell the API server that a request it receives is from you and that you are allowed access to the data. Take a look at the documentation and browse the collection.

  1. Add a request: Fork the Postman API collection to your public workspace in the same way you forked today’s challenge. Then find a request to get all of your collections. Duplicate it, and drag the copy over to this folder Authorization. Rename the request All Collections - header.
  2. Add a header: In the collection documentation, we see there are two ways to authorize this particular request. Let’s start with adding an authorization header. Under the Headers tab, add a key x-api-key with the value {{postman_api_key}}. Hover over the variable to make sure Postman is reading in the correct value from an active environment. If the Postman API key is not already added to your environment, do that now. Send to make sure you receive a 200 status code, and then Save your changes.
  3. Add a query parameter: Duplicate the request, and rename the request All Collections - query params. In this new request, delete the header you added in the previous request. Again, following the instructions in the collection documentation for this particular API, go to the Params tab. Add a key apikey with a value {{postman_api_key}}. Send to make sure you receive a 200 status code, and then Save your changes.
  4. Add an auth helper: Instead of manually adding a header or params, let’s use one of the authorization helpers provided by Postman. Duplicate the last request, and rename the request All Collections - auth helper. Delete the key-value pair under the Params tab. Under the Authorization tab, select API key type from the dropdown. Add x-api-key and {{postman_api_key}} to be added as a header. Send to make sure you receive a 200 status code, and then save your changes. Look under Headers to see the header that Postman auto-generated from the auth helper.
  5. Add collection-level auth: Since all of the requests in this collection require the same authorization method, let’s add a collection-level authorization helper. For each of these three requests, delete the added header, delete the params, and update the Auth type to Inherit auth from parent. The parent of this request is the folder or collection that contains these requests. Select the collection Authorization, and add the API key auth helper under the Authorization tab like you did in the previous step. Send at least one of the requests to make sure you receive a 200 status code, and then save all of your changes.

There’s a number of ways API servers can require authorization. Take a look at the other auth helpers available in Postman.

Postman can capture cookies for a browser or client application using the Postman proxy or Postman Interceptor. You can’t sync cookies with the Postman web app. Make sure you’ve installed the Postman desktop app. Take a look at the additional resources and try syncing cookies on your own.

Once you complete these steps, move on to the next folder in this collection to submit your solution. Follow the instructions in the request documentation.

I checked every step three times, but probably miss something. Response status 200 ok, so it passed authorization with the API key. Also, the name of the collection was obtained without any problems. Only a test with request names failed.

Can you also share the response body payload, please? The test is reading the values from this and running the assertions against it.

I did notice that the names of your requests are not correct, as per the documentation:

You have All collections - header and the assertion is against All Collections - header. Those request should all be uppercase C for Collection.

OMG “Eagle eye”, thank you

1 Like

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