I have a ReactJS web app that works with Firebase Cloud Functions. Everything was running fine for a long time until I recently started doing some maintenance on the code and suddenly all of the Callable functions are giving me this error:
Failed to execute 'fetch' on 'Window': Illegal invocation at Service
It doesn't execute any server code so it's on the client, I am not sure what else to try. I am able to invoke the functions from GCP without any problems.
EDIT:
TL:DR; Firebase version 7.22.x was breaking the fetch call for me. Any version prior to that (I tested as low as 7.5.x) worked without any problems.
So after debugging more and more, I decided to work with more restricted versions in my package.json. At first I was suspecting that either Firebase, React or TS might be breaking something.
I started playing with Firebase versions. In my package.json, I was using Minor Versioning with the version set to ^7.5.0. I restricted the versioning further by using Patch Versioning (~7.5.0) and all the sudden, this error was gone!
To pin-point which version was the trouble (also I wanted to use the latest I can), I started incrementing the versions up to the most recent (7.22.x at this time). I found out that the latest version that works for me was ~7.11 and that's where I am gonna stay at until the root cause is fixed.