Skip to content

[BUG] Pre-Request Script Returns TypeError: Cannot read properties of undefined (reading 'map') #3251

@pd-proshoperp

Description

@pd-proshoperp

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Hi,

I wanted to report a regression bug introduced in v8.5.3 that breaks pre-request scripts.

Issue:
Pre-request scripts that work correctly in v8.5.0 fail in v8.5.3 with the following error:

TypeError: Cannot read properties of undefined (reading 'map')
at eval (eval at (/iframe-sandbox/assets/index-DL_PXIxX.js:1:7435), :26:29)

Steps to Reproduce:

  1. Install Altair v8.5.3
  2. Add a pre-request script that performs a POST request to authenticate and sets a token environment variable
  3. Send a request — the pre-request script fails with the above error

Sample pre-request script:

const username = altair.helpers.getEnvironment("username");
const password = altair.helpers.getEnvironment("password");
const scope = altair.helpers.getEnvironment("scope");
let endpointUrl = altair.helpers.getEnvironment("endpointUrl");
if (endpointUrl.endsWith("/")) {
  endpointUrl = endpointUrl.substring(0, endpointUrl.length - 1);
}

if (altair.helpers.getEnvironment("doAuth")) {
  const response = await altair.helpers.request(
    "POST",
    `${endpointUrl}/api/beginsession`,
    {
      body: {
        username: username,
        password: password,
        scope: scope
      }
    }
  );
  altair.helpers.setEnvironment("token", response.authorizationResult.token);
}

Expected Behavior:
The pre-request script should execute successfully as it does in v8.5.0.

Actual Behavior:
The script fails with a TypeError inside Altair's internal sandbox code. The error originates at line 26 of the eval wrapper, not in the user's script itself.

Workaround:
Downgrading to v8.5.0 resolves the issue.

Environment:

  • Altair version: 8.5.3
  • Working version: 8.5.0

Happy to provide additional details if helpful.

Thanks

Expected Behavior

No response

Steps To Reproduce

Steps to Reproduce:

  1. Install Altair v8.5.3
  2. Add a pre-request script that performs a POST request to authenticate and sets a token environment variable
  3. Send a request — the pre-request script fails with the above error

Sample pre-request script:

const username = altair.helpers.getEnvironment("username");
const password = altair.helpers.getEnvironment("password");
const scope = altair.helpers.getEnvironment("scope");
let endpointUrl = altair.helpers.getEnvironment("endpointUrl");
if (endpointUrl.endsWith("/")) {
  endpointUrl = endpointUrl.substring(0, endpointUrl.length - 1);
}

if (altair.helpers.getEnvironment("doAuth")) {
  const response = await altair.helpers.request(
    "POST",
    `${endpointUrl}/api/beginsession`,
    {
      body: {
        username: username,
        password: password,
        scope: scope
      }
    }
  );
  altair.helpers.setEnvironment("token", response.authorizationResult.token);
}

Environment

- Platform: Altair Desktop client
- Version: 8.5.3 (not working), 8.5.0 (working)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions