MV3 - Fetch() API call gets terminated after 30 before response is received from REST end point

182 views
Skip to first unread message

iMan addon POC

unread,
Sep 19, 2023, 9:27:58 AM9/19/23
to Chromium Extensions

Hi Chrome Extension Team, 

 

Scenario: 

We have chrome extension built using MV2 and will invoke HTTP based REST API end points and it works. Many REST API end points takes more than 30 seconds to process request & sends response back to the chrome extension without any issue. 

 

Issue: 

We are redesigning the extension using MV3 and when we invoke REST API end point using fetch() method and it works when response is received from server with in 30 seconds. But some REST API’s take more than 30 seconds to serve the request and hence fetch() method is getting terminated abruptly before the response is received from server. 

 

Need Clarification: 

  1. Is MV3 had any plan in future to overcome 30 seconds time limit for fetch() API call. 
  2. Could you suggest any workaround for 30 seconds time limit issue with fetch() method when REST API’s are invoked in MV3 environment. 

 

 

Thanks in Advance 

Shashikiran 

Chromium Extensions

unread,
Sep 19, 2023, 11:59:10 AM9/19/23
to Chromium Extensions, iMan addon POC
I've suggested adding `fetch` in https://crbug.com/1418780.
Meanwhile you can use a simple workaround:

let keepAlive = setInterval(chrome.runtime.getPlatformInfo, 25e3);
let res = await (await fetch(url)).json();
clearInterval(keepAlive);

This will work for as long as Chrome team doesn't walk back on its claim that is an intended feature, but I hope they will introduce a proper solution by then.

Juraj M.

unread,
Sep 20, 2023, 7:39:37 AM9/20/23
to Chromium Extensions, Chromium Extensions, iMan addon POC
Regarding this:

let keepAlive = setInterval(chrome.runtime.getPlatformInfo, 25e3);

How can you tell that " getPlatformInfo" internally doesn't use "this" or won't use it in the future?
Or is this a known thing in extensions API and I can freely pass all functions around as parameters? :)

wOxxOm

unread,
Sep 20, 2023, 8:09:12 AM9/20/23
to Chromium Extensions, Juraj M., Chromium Extensions, iMan addon POC
Only methods that are shared between similar objects need `this` by design e.g. StorageArea.set or ApiEvent.addListener.

Sebastian Benz

unread,
Sep 20, 2023, 6:49:55 PM9/20/23
to wOxxOm, Chromium Extensions, Juraj M., iMan addon POC
Thanks for flagging this Shashikiran. This is on the Chrome team's roadmap and the plan is to provide a proper solution for this. Until then, wOxxOm's workaround is the way to go.

--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/13aaad28-0368-4dd3-9cde-02ef68f80fd4n%40chromium.org.

Dr. Sebastian Benz

Developer Programs Engineer

sb...@google.com


Google Germany GmbH

Erika-Mann-Straße 33

80636 München


Geschäftsführer: Paul Manicle, Liana Sebastian

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg


Diese E-Mail ist vertraulich. Falls Sie diese fälschlicherweise erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter, löschen Sie alle Kopien und Anhänge davon und lassen Sie mich bitte wissen, dass die E-Mail an die falsche Person gesendet wurde. 

     

This e-mail is confidential. If you received this communication by mistake, please don't forward it to anyone else, please erase all copies and attachments, and please let me know that it has gone to the wrong person.


iMan addon POC

unread,
Sep 28, 2023, 8:46:06 AM9/28/23
to Chromium Extensions, Sebastian Benz, Chromium Extensions, Juraj M., iMan addon POC, wOxxOm

I tried the workaround suggested by @wOxxOm's by calling multiple HTTP REST End points using fetch() API and it is working. 

 

Thanks @wOxxOm for suggesting workaround. 

 
@Sebastian Benz: Thanks for acknowledging. Could you please share tentative timeline for the roadmap of MV3. 

Sebastian Benz

unread,
Sep 28, 2023, 8:49:32 AM9/28/23
to iMan addon POC, Chromium Extensions, Juraj M., wOxxOm
Great to hear it works now. Unfortunately, there are no updates on the MV3 timeline yet. 
Reply all
Reply to author
Forward
0 new messages