"TypeError: Cannot read property 'links' of undefined" ONLY when using scheduled runs

My question:
I have a folder with 4 GET requests where I write out the results into variables using “Tests”.
Running them individually or the whole folder with the Runner works flawlessly.
BUT, when I schedule the runs, I always get the following error:
TypeError: Cannot read property ‘links’ of undefined

I have absolutely no clue what could be different, when I run the folder scheduled rather than manually.

Details (like screenshots):
GET request
https://api.rasterwise.com/v1/get-scrape?url=https://www.website.com&extract=links,images&scope=.class

Response body

{
    "status": "success",
    "pageStatus": 200,
    "scrapeDate": "2022/11/24",
    "results": {
        "scopedto": ".class",
        "links": [
            {
                "text": "",
                "host": "example.com",
                "url": "https://example.com/",
                "radiusContext": {
                    "parentText": "test",
                    "nextSiblingText": "test"
                }
            }
        ],
    }
}

Test
let response = pm.response.json();
pm.environment.set(“variable”, response.results.links[0].url);

1 Like

Hi @florian

How are you scheduling the runs?

Hi @w4dd325
by going to the collection > Run collection > Schedule runs (Periodically run collection at a specified time on the Postman Cloud.)

I finally found the issue, it is about the handling of Authorization.
When running it manually in the Collection Runner it used the credentials from the Collections’ Authorization-tab.

But apparently the Postman Cloud is not. Because as soon as I added the credentials (API key) to the get request URL it worked.

Hopefully this is helpful to someone as well.