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.