Unknown GraphQL Error xen_invocation_service

I’m creating a forge app using Custom UI and the forge bridge.

One of the invokers of the bridge keeps throwing an error:

Error: GraphQL error: The underlying service call failed. The underlying service xen_invocation_service status code is : 400

Google provides no answers and I can’t see anything in the atlassian documentation for this specific error.

It is happening on a specific invoker. The code for the invoker is known to be working. This error was sparodic last week and consistent this week. All the invoker is doing is sending a payload to an azure function and receiving a response. The URL for the function is specified in the manifest so this shouldn’t be a permissions issue from that side of things (not that the code even reaches that far).

The call for the invoke as it currently stands. It is hitting catch block of this particular invoke every time with the above error

if (Object.keys(issueData).length > 0) {
    const key = issueData?.fields?.project?.key;
    console.log('ISSUEKEY<<<<', { key });
    helpers.issueData = issueData;
    invoke('getWorkTypes', { key }).then(workTypes => {
        console.log({ workTypes });
        setTypeOfWorkOptions([{ value: '', label: 'Please choose' }, ...JSON.parse(workTypes.body.value)]); 
    }).catch(err => {
        console.error('getWorkTypes::Error', { err });
        setAlert(`${err.toString()}::${JSON.stringify(err)}`, { key });
    });
}

The invoker itself. When I am using the forge tunnel, I can see its not even trying to run any of this code. The first console log is not even being run:

app.define('getWorkTypes', async (req) => {
    console.log('getWorkTypes::req', req);
    try {
        const { key } = req.payload;
        console.log('getWorkTypes::key', { key });
        const data = JSON.parse(await getData());
        const secrets = JSON.parse(await getSecrets());
        // console.log('getWorkTypes::data/secrets', { data, secrets });
        const oauth = getAuth(data, secrets, data.deployment);
        const bcUrl = buildUrl(data, 'GetWorkTypes');
        // console.log('getWorkTypes::oauth/url', { oauth, bcUrl });
        const bcResponse = await getWorkTypes(bcUrl, oauth, data.companyName, key);
        console.log('getWorkTypes::bcResponse', { bcResponse });
        return bcResponse;
    } catch (error) {
        console.log('getWorkTypes::Error', { error });
        return { error };
    }
});

Every other invoke function in this app is behaving as it should. As I said, last week this was a sparodic issue. On friday it was happening on about 60% of the time trying to run the app. Now its 100% of the time.

As far as I can tell, my code is fine, which leads me to think this issue is environmental within Jira, but without any more information on the error, its difficult to tell.

Any ideas would be helpful. At this point there are no such things as bad ideas

Hi @RichardSefton ,

Can you please share the appId and a site that you are using for testing so that we can check this in more details?

If you prefer not to share these details in a public comment, feel free to send me a direct message.

Cheers,
Caterina

I can confirm the error with GraphQL for one of our confluence forge apps (production).

Hi @ccurti

I will send you a direct message with these details, but I made some code changes last night and it suddenly started working.

I’m not sure if this is something I did that fixed it (I can’t think what) or if its something in the environment that corrected itself.

Either way I wouldn’t mind some kind of insight as to what causes this error to be thrown in the first place in case it happens again. I’m sure @a.yessipovskiy would agree.

1 Like

FYI, I have submitted a relevant bug ticket to the support: Jira Service Management

Hi Team,

We believe the root cause of this issue has been fixed and we’d like you to confirm that this issue no longer affecting your apps. If you are still having issues, please let us know and we’ll investigate further.

Regards,
James.

Thank you for this.

What was the issue in the end though?

1 Like

Hi Team,

The answer I have from the engineers is

The execution engine for our GraphQL Gateway was being updated and it turned out to be affecting the structure of some requests passed to the downstream service. The affected requests had an invalid structure that the downstream services could not process. It was a bit difficult to trace the problem because it was being progressively rolled out.

Regards,
James.

4 Likes