Webtrigger returning 424 Failed dependency

I have tried setting up a webtrigger both in my own app and just using the example one here:

https://bitbucket.org/atlassian/forge-issue-alerting/src/master/README.md

Going through the setup to get a url:

  1. Get the Forge installation IDs for the app by running. forge install:list
  2. Get the webtrigger URL using the Jira installation ID from step 1 by running. forge webtrigger <jira-installation-id>
  3. Set the environment variable by running. forge variables:set WEBTRIGGER_URL "<webtrigger-url>"
  4. Redeploy the app to use the environment variable. forge deploy

Both triggers return “Failed Dependency” when curl’ing them, presumably because it can’t find the webtrigger function.

{“timestamp”:“2021-03-18T12:27:52.678+00:00”,“path”:“xx”,“status”:424,“error”:“Failed Dependency”,“requestId”:“xxx”}%

Does anyone have a hint where I am going wrong?

Thanks,

B

1 Like

Hi @BrettB,

That error message usually indicates that your trigger function didn’t return an acceptable response - possibly because an error was thrown. You can try wrapping your function with a try/catch, and returning the error details. Something like…

try {
  // do the things
} catch (err) {
  return buildOutput(String(err), 500, 'Internal Server Error');
}
2 Likes

Hello,

I tried wrapping my function with a try catch, but the code is never reaching the catch and still returning the 424 error. Any hints on how to proceed?

Is it possible that’s something related to rate limit or size of the body object? I get a correct response when I return a smaller object, or could it be there’s something messed up in the data it’s not able to stringify it?

Thanks,

Having the same error, and I’m not even doing anything

export async function taskCreated(value) {
  console.log('taskCreated: ', JSON.stringify(value, null, 2));
  return {ok: true};
}

I tried with no return, and in both cases the same error and the console.log is not hit.
What is buildOutput? Seems like it should work without a return though.

edit: I found [FRGE-489] - Ecosystem Jira but no luck there either.

export async function taskCreated(value: any) {
  let err: Error | undefined;

  try {
    console.log('taskCreated: ', JSON.stringify(value, null, 2));
  } catch (e) {
    console.log(`taskCreated error: ${e}`);
    err = e;
  }

  return {
    body: err ? `{"error": "${err.message}"}` : '{"hello": "world"}',
    headers: {
      'Content-Type': ['application/json'],
      'X-Request-Id': ['example'],
    },
    statusCode: err ? 400 : 200,
    statusText: err ? err.message : 'OK',
  };
}

And get this:

{
    "timestamp": "2022-09-08T17:33:30.499+00:00",
    "path": "/x1/L4-I8W7xWunEunceEBKbvVTqau0",
    "status": 424,
    "error": "Failed Dependency",
    "requestId": "98c5752e-62703"
}

This page: https://developer.atlassian.com/platform/forge/manifest-reference/modules/web-trigger/ needs an example of the request, response and an example of the function defined.

I was posting the following to the webhook:


And manifest has the following:

modules:
  webtrigger:
    - key: task-created-webtrigger
      function: task-created-web-func
  function:
    - key: task-created-web-func
      handler: web-triggers.taskCreated

Was able to solve this. Basically any time you change manifest for webtriggers you need to do forge deploy even if just using the tunnel.