Day 26 - 30 Days Developer Postman

Hello, Im stuck on day 26 and not even chat GPT can help me.
Any sugestions? the “submit” request is still showing the error "JSONError: No data, empty input at 1:1 "
I tried removing this section of the test and clearly the problem is with these validations:

    let collVar = collection.variable.find(variable => { return variable.key === 'links'})
    pm.expect(collVar.key, 'check collection variable set').to.equal('links')
    pm.expect(JSON.parse(collVar.value), 'check collection variable array')'array')

My request “bing” is returning 200 and working fine,
this is my code:

var cheerio = require('cheerio');

var htmlResponse = pm.response.text();
console.log("HTML Response:", htmlResponse);

const $ = cheerio.load(htmlResponse);

let links = [  ];
$('a').each(function () {
    let href = $(this).attr('href');
    if (href && href.startsWith("http")) {

pm.collectionVariables.set('links', JSON.stringify(links));
console.log("Links variable set:", JSON.stringify(links));

pm.test("Status code is 200", function () {;

pm.test("Validate the array", function () {
    var linksJsonString = pm.collectionVariables.get("links");
console.log("Links JSON string:", linksJsonString);

if (linksJsonString) {
    try {
        var storedLinks = JSON.parse(linksJsonString);
        console.log("Stored Links:", storedLinks);
        console.log("Extracted Links:", links);
    } catch (error) {
        console.error("Error parsing JSON:", error);
} else {
    console.error("The 'links' variable is empty or undefined.");

Hey @security-geoscient13 :wave:

Welcome to the Postman community! :postman:

What are the steps listed in the documentation for that days task?

Removing sections of the test is not the correct thing to do here, as thats checking that days challenge. Your submission would be invalid if anything has changed there.

The failures looks like it’s unable to parse the information in the response, I would advice starting all over again and working through the steps one by one, to ensure you have followed them correctly.

Can you also share the Public link to your Workspace, please?

When the submit fails in this manner, just clone the submit request (so you don’t change the original) and then console log any variables around the failing test, so you can see what is being returned.

This will usually point you in the right direction.

In this case, it will be the third line that is failing to parse collvar.value. An array would be a valid JSON object, so I suspect the find on the first line is not returning an array or is undefined. As I said, the console log is your friend in these situations.