# Panic: runtime error: invalid memory address or nil pointer dereference

**URL:** <https://community.grafana.com/t/panic-runtime-error-invalid-memory-address-or-nil-pointer-dereference/116944>\
**Category:** k6-browser\
**Tags:** performance, configuration\
**Created:** [March 13, 2024, 10:19pm UTC](https://community.grafana.com/t/panic-runtime-error-invalid-memory-address-or-nil-pointer-dereference/116944 "2024-03-13T22:19:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![adnanerlansyah403](https://avatars.discourse-cdn.com/v4/letter/a/e68b1a/32.png) [@adnanerlansyah403](https://community.grafana.com/u/adnanerlansyah403)\
**Post date:** [March 13, 2024, 10:19pm UTC](https://community.grafana.com/t/panic-runtime-error-invalid-memory-address-or-nil-pointer-dereference/116944/1 "2024-03-13T22:19:56Z")

</div>

Hello everyone, can anyone help me out about how to fix this error? So wheneverI tried to run the performance test for web I always got error like that even though my data has already been there.

- File mainPage.js

```auto
import { group, sleep } from "k6";
import { Rate } from "k6/metrics";
import { config, k6config } from "./k6.config.js";
import { accountUser, baseURL, serviceURL, slug } from "./helpers/common.js";
import { htmlReport } from "https://raw.githubusercontent.com/benc-uk/k6-reporter/main/dist/bundle.js";
import { textSummary } from "https://jslib.k6.io/k6-summary/0.0.1/index.js";
import { Homepage } from "./pageObjectModel/Homepage.js";

export const pageOptions = config
// export let errorRate = new Rate('Failed Requests');

/**
 * Pages
 */
var homepage = new Homepage(baseURL);

export function setup() {
    console.log('>>>>>>>> Starting ⌛ <<<<<<<<<')
}

export default function () {

    // Pages
    group('Visit Homepage', () => {
        // homepage.testHomePage();
    })
    // errorRate.add(!auth.getResult())
    sleep(1)
}

export function teardown(data) {
    console.log('>>>>>>>> TESTING COMPLETED <<<<<<<<<')
}

export function handleSummary(data) {
    console.log('>>>>>>>> GENERATING REPORT <<<<<<<<<')
    let date = new Date();
    return {
    [`report-${__ENV.NODE_ENV}-${slug}-${date.getFullYear()}-${date.getMonth()}-${date.getDate()}` + "_summary.html"]: htmlReport(data),
      stdout: textSummary(data, { indent: " ", enableColors: true }),
    };
}

```

- File Homepage.js

```auto

import { browser } from 'k6/experimental/browser';
import { sleep } from 'k6';
import { baseURL } from '../helpers/common.js';
import { config } from '../k6.config.js';
import { BasePage } from '../helpers/basePage.js';

export class Homepage extends BasePage {

  constructor(endpoint) {
      super(endpoint);
      // this.url = this.url.concat('auth/');
  }

  async testHomePage() {
  
    const page = browser.newPage();
  
    try {
        // Test logic for the home page
        await page.goto(baseURL);
        sleep(1);
    } finally {
        await page.close();
    }
  }
}

```

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/a/4/a45e241fd56efb14e56f474edad078fd4f2ac337.png)

---

<div class="post-metadata">

**Author:** ![adnanerlansyah403](https://avatars.discourse-cdn.com/v4/letter/a/e68b1a/32.png) [@adnanerlansyah403](https://community.grafana.com/u/adnanerlansyah403)\
**Post date:** [March 14, 2024, 2:57am UTC](https://community.grafana.com/t/panic-runtime-error-invalid-memory-address-or-nil-pointer-dereference/116944/2 "2024-03-14T02:57:39Z")

</div>

Please anyone help me out with this issue

---

<div class="post-metadata">

**Author:** ![ankur](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/ankur/32/35773_2.png) [@ankur](https://community.grafana.com/u/ankur)\
**Post date:** [March 19, 2024, 4:25pm UTC](https://community.grafana.com/t/panic-runtime-error-invalid-memory-address-or-nil-pointer-dereference/116944/4 "2024-03-19T16:25:33Z")

</div>

Hi @adnanerlansyah403,

Welcome to the forum!

I will need all the files and a publicly accessible website to be able to try and reproduce the issue. It would also help if you could copy and paste the full error message so that I can see the full stack trace.

It’s worth noting that `group` doesn’t work with async functions.

Cheers,  
Ankur
