Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to fetch job meta info: Not Found #35

Open
matzetronic opened this issue Aug 25, 2023 · 2 comments
Open

Failed to fetch job meta info: Not Found #35

matzetronic opened this issue Aug 25, 2023 · 2 comments

Comments

@matzetronic
Copy link

Hi,

Im trying to run the example using selenium webdriver (JS/TS) and use the graphQL API for that. First I create a webdriver instance similar to your java code. Then I run the following code to set things up:

        const visualConfig: VisualConfig = {
            region: "eu",
            user: process.env.SAUCE_USERNAME,
            key: process.env.SAUCE_ACCESS_KEY
        };
        const api = getApi(visualConfig);
        const build = await api.graphql.createBuild("Check Inventory");
        console.info(`created build ${build.name}(${build.id})`);

        const visual = new SauceVisualService();
        const sessionId = (await driver.getSession()).getId();

        const loginPage = new LoginPage(driver);
        const inventoryPage = new InventoryPage(driver);
        await loginPage.open();
        

I can see on saucelabs.com that the build was started successfully. I now try to get the metadata from the build:

        const session = await api.graphql.webdriverSessionFromArchive({
            sessionId,
            jobId,
        });

But then I run into this error:

file:///Users/xyz/git/visual-examples/wd-js/node_modules/@apollo/src/errors/index.ts:97
    super(errorMessage);
    ^
ApolloError: [trace/span=7cc193f9d78897b0523a969a84aa7978/979ec5c33fce66c7] Failed to fetch job meta info: Not Found
    at new ApolloError (file:///Users/xyz/git/visual-examples/wd-js/node_modules/@apollo/src/errors/index.ts:97:5)
    at file:///Users/xyz/git/visual-examples/wd-js/node_modules/@apollo/src/core/QueryManager.ts:1146:36
    at both (file:///Users/xyz/git/visual-examples/wd-js/node_modules/@apollo/src/utilities/observables/asyncMap.ts:31:30)
    at file:///Users/xyz/git/visual-examples/wd-js/node_modules/@apollo/src/utilities/observables/asyncMap.ts:20:47
    at new Promise (<anonymous>)
    at Object.then (file:///Users/xyz/git/visual-examples/wd-js/node_modules/@apollo/src/utilities/observables/asyncMap.ts:20:16)
    at Object.next (file:///Users/xyz/git/visual-examples/wd-js/node_modules/@apollo/src/utilities/observables/asyncMap.ts:32:39)
    at notifySubscription (/Users/xyz/git/visual-examples/wd-js/node_modules/zen-observable/lib/Observable.js:135:18)
    at onNotify (/Users/xyz/git/visual-examples/wd-js/node_modules/zen-observable/lib/Observable.js:179:3)
    at SubscriptionObserver.next (/Users/xyz/git/visual-examples/wd-js/node_modules/zen-observable/lib/Observable.js:235:7) {
  graphQLErrors: [
    {
      message: '[trace/span=7cc193f9d78897b0523a969a84aa7978/979ec5c33fce66c7] Failed to fetch job meta info: Not Found',
      locations: [Array],
      path: [Array]
    }
  ],
  protocolErrors: [],
  clientErrors: [],
  networkError: null,
  extraInfo: undefined
}
Process exited with code 1

Is the required sessionId not webdrivers session id? Where can I get it from? 🤔

Thanks!

@FriggaHel
Copy link
Collaborator

Hi @matzetronic !

Are you running the selenium session on Sauce Labs or on your own grid ?
Does this error happen consistently or randomly ?

The api.graphql.webdriverSessionFromArchive routine allows you to retrieve the Browser/OS combination from a Sauce Lab session (represented it's id) and to attach it to the upcoming visual checks. If the selenium session is not running on Sauce, this call should not be used.
Note: We are aware of randomly occurring error on that endpoint. We have found the root cause and are in the process of fixing it.

Let me know if that helps.

@matzetronic
Copy link
Author

Hi,
I'm running the session on saucelabs and it happens consistently.

This is the code to create the driver:

export class TestUtils {
    
    static async getWebDriver(username: string = process.env.SAUCE_USERNAME, accessKey: string = process.env.SAUCE_ACCESS_KEY): Promise<WebDriver> {
        if (!username || !accessKey) {
            throw("Sauce Labs credentials not found. Please set SAUCE_USERNAME and SAUCE_ACCESS_KEY in your environment");
        }
        // Can be found at "Driver creation" on https://app.saucelabs.com/user-settings
        const webDriverUrl = "https://" + username + ":" + accessKey + "@ondemand.eu-central-1.saucelabs.com:443/wd/hub";

        // Set capabilities for WebDriver
        const caps: Capabilities = new Capabilities();
        caps.setBrowserName("chrome");
        const builder = new Builder().withCapabilities(caps);
        builder.usingServer(webDriverUrl);
        return await builder.build();
    }
}

// inside test files:
const driver = await TestUtils.getWebDriver();

🤷🏻‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants