Error 407 - PROXY_UNAUTHORIZED

Hi. My code is running requests for “Search for issues using JQL” API (https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search/#api-rest-api-3-search-get). After several calls (seems to be happening more or less after same number of calls (~15), I’m getting the error: “Forge platform failed to process runtime HTTP request - 407 - PROXY_UNAUTHORIZED”.
Any idea?

Hello @MosheYakobovich,

Can you please provide your app ID so our team can investigate?

Also, is this happening while you are running a forge tunnel? If so, roughly how long do the previous (successful) calls take?

Hi, it 2d733338-9891-46bb-9545-71e3f6bf824b.
Yes, this is happening when running a forge tunnel. I’m calling this api in a loop (due to paging) - If I kill forge tunnel and run, I start getting the errors around call #15 and then it never stops (even when I’ve put a long sleep). If I kill forge tunnel and immediately try again, it’s the exact scenario.
I’d appreciate any assistance, thank you very much.

When your deployed Forge app is invoked, it has a maximum run time of 25 seconds. After that time, it will be terminated.

When you are running the app in the tunnel, the run time limitation doesn’t apply so you can debug your app at your convenience. However, the token the app has in order to call Jira is only valid for the expected runtime duration (with a bit of a buffer). Therefore, after 25 seconds any Jira calls you make will fail.

I suggest developing the app with the invocation time limit in mind, so that it won’t be terminated unexpectedly when you deploy it. You might want to only do a few calls per invocation, and use Async Events if you need to process a lot of data.

Our messaging about the error can definitely be better though! Thank you for bringing it to our attention, we’ll look into improving it.

Thanks much. I have to say that this difference is a little confusing, if possible I would at least issue a warning in tunnel about the 25 seconds.
using Async events, there’s no limitation on processing time? Meaning, I tried it and moved the logic to an async event handling, I’m still getting those messages. Is it also 25 seconds limit per event handling?

Sorry about the confusion.

The async event handlers still have a time limitation, so you will need to split the work you want to do into chunks and queue several events if it’s too much for one invocation.

OK, that’s what I figured but I wanted to make sure, also to know if it’s the exact same limitation. It is clear now, I’ll do the conversion and hope not to bump into anything new :slight_smile:
Thank you for you assistance!

Update: I did the conversion. single event handling doesn’t take more than a few seconds - but still I’m getting the same error (after a bit of a longer period, but still). I checked and as far as I can tell, I’m not violating any of the Async Events limitations. Any idea?

This is unexpected. To confirm:

  • You are scheduling several async events
  • Async event handler only makes a few calls, not an unbounded number (e.g. a maximum of 5)
  • First few (?) async invocations succeed
  • Then an async invocation starts and immediately gets PROXY_UNAUTHORIZED

Is my understanding above correct?

Do you have invocation IDs, trace IDs or at least the app ID where this happens?

Hi.
The app ID is 2d733338-9891-46bb-9545-71e3f6bf824b.
From the event processing I am calling several calls - 1 call to
search api but then up to 50 to Get epic with fields=status filter. So it’s more than 5, but I didn’t see any specified limit that I’m passing. Other than that, your understanding is correct - several event processing succeed, and then I’m starting to get the 407 error. I hope you can shed some light over the issue.
Again, thanks.

Hi Moshe,

Do you mean you’re still using forge tunnel to work with the async events? The 25 second limit for the token used for Jira calls still applies, so regardless of the number of calls, if they take a long time the token will expire. (And when your app is deployed, it will be terminated instead.)

We are checking that there are no further issues with your app - if we find anything else wrong, we’ll let you know!

Hi.
Well yes, as long as I’m still in development and debugging it I am using forge.
Anyway, since we seem to have 24 hours communication cycle between us I will try to be more clear with my issue.
When you say “The 25 second limit for the token used for Jira calls still applies” - what do you mean? I assumed that if I move to async events as you advised, each event execution cannot be more than 25 seconds (otherwise I don’t see the point). So for me each execution takes several seconds, but there are quite a few events and at some point I’m starting to get the error.
If my assumption is wrong, I need a way to be able to execute longer task (I don’t mind splitting it, it can be done during a period of time, this is an internal app that will run on a daily basis).

Hi Moshe, sorry about the delay in response.

You are correct that each invocation is limited to 25 seconds. Splitting it to be processed by async events should work.

I suggest, purely for debugging this problem, deploying and executing your app without the tunnel. If you receive a lot of async events, processing them can still take more than 25 seconds on your local machine because the tunnel processes events one by one, whereas the deployed app can do so in parallel.

Alternatively, push individual events to the queue with an increasing delay so your tunnel has enough time to process each individual event.

Thanks for your response. I will check it out - I’m not sure since I added time logging and the local processing seems short, but I will try both of your suggestions. It will probably take me a while due to holidays but I will update later on.
Again, thanks.

Hi.
I also encountered this issue when i using forge tunnel to debug my app. I can understand split my job into several small works, but what if i did have a request that need more than 25 seconds(e.g.: waiting for the sever to do some other tasks and then use the return value to do some thing). So i wonder is there any solution for processing the request more than 25 secs? Once the app is deployed, all request longer than 25 seconds will be terminated and can’t get any response from my sever?

Thanks.

Async tasks have an increased time limit, currently it’s 55s. Does that address your need here? If not, could you share some real live use cases in which it is insufficient for you?

1 Like

yeah, of course. We are doing an agent application. we use the question from the issue comment as prompt and ask the agent to do some tasks. So my app should wait util agent finish all the tasks and send the response back, then using the response to do some thing on jira platform.

I’m thinking maybe there is any way to add an endpoint on jira app, so there is no need for the app to wait until agent finish its task. The agent just have to request we just defined in jira app to notify the app some task have been done and the jira app start to do the following work.

If I understand correctly, your idea is that app initiates the work on remote agent and then agent could call the app back once the job is done - which should solve the issue with too short timeout. That indeed sounds like something you could do with use of Web Trigger - have a look at documentation here: https://developer.atlassian.com/platform/forge/manifest-reference/modules/web-trigger/ (you can generate publicly accessible url and share it with agent as communication channel to accept the callback).

One thing to keep in mind is that you will have to employ some custom authorization to ensure that webtrigger is secure (as it can be called by anyone who guesses the URL). But it shouldn’t be too hard if you control the agent and can adjust it’s behavior.

If the agent can solve the work faster than in 55s you could still use the async tasks. Also, another option could be to start the work on the agent side and poll for the results - you can schedule another Async Task in case the agent has not completed the work yet and the Async Task is about to run out of execution time.

ok, I will have a look on the web trigger, Thanks