Elastic Synthetics stuck in pending when using API options

I am trying to run an elastic synthetics test using the inline script editor however when I run the following step and run a manual test to verify the test, the run seems to get stuck in pending then returns "Failed to get any results back for manual test run"

step("Internal user login", async () => { 

    let token;

    page.on('response', async (response) => {
      if (response.request().url().endsWith('/token') && response.request().method() === 'POST') {
        const responseBody = await response.json();
        token = responseBody.access_token;
      }
    });

    const url = 'NotTheRealUiUrl';
    await page.goto(url);
    await page.getByText('Reject All Cookies').click();
    await page.locator('[aria-label="Sign in"]').getByRole('button').click();
    await page.locator('#signInEmail').fill('NotTheRealUser');
    await page.locator('#continue').click();
    await page.getByPlaceholder('password').fill('NotATheRealPassword');
    await page.locator('[type="submit"]').click();
    await page.waitForURL(url);
    await page.locator('[heading="Surveys"]').locator('h2').click();

    while(!token) {
        await new Promise(resolve => setTimeout(resolve, 500));
    }

    const options = {
      headers: {
        Authorization: `Bearer ${token}`
      }
    };
    
    const response = await request.get(
      'NotTheRealAPiUrl', options);
});

I've placed this all in on step for simplicity. Interestingly when I remove the options object and the options variable from the script (i.e. make the get request without options) the test runs and does not get stuck in pending. Any suggestions?

Hi @elfarlo13,

Before we look into this in more detail, can I suggest refactoring all template literals in your script for string concatenation?
We have an open issue at the moment for these, as they break the journey code when using Synthetics UI:

// This 
 Authorization: `Bearer ${token}`
 // For this
Authorization: "Bearer "+ token

Hope that helps!

Perfect, updated to string concatenation and this has resolved the issue. Thanks for the prompt reply :slight_smile: