Firebase hosting sends same main.dart.js file twice: Flutterfire Firebase Hosting - flutter

Halo, i'm flutter dev recently diving into web field. I hosts my release build with Firebase Hosting, and just found a weird behaviour in the gc Logs Explorer.
My bundles are working just fine and init load time is fast. But, strangely, main.dart.js is sent twice for a single client browser get request. In the client browser console, nothing seems weird: only one single main.dart.js is identified in the network tab. But in a specific environment, Firebase Hosting sends main.dart.js twice in a moment of a blink. No other files or assets are sent twice. They just worked fine, sent only once. I've collected the environments where the main.dart.js is sent twice. Btw, my app is just a test classic counter app, only containing http package in addition(purpose of testing the compiled size of http package). No change in default index.html or elsewhere.
Below list shows the envs where Firebase Hosting send main.dart.js twice.
mobile private browsing safari (version is specified in the screenshot: 2022-09-06T09:56:27Z: before cache cleared
mobile private browsing safari (version is specified in the screenshot: 2022-09-06T09:46:21Z: after cache cleared
(i will edit the list if more envs show this weird behaviour)
I've just followed the basic instructions. Nothing special, so confused now. Hope some gurus would figure out the reason why Firebase hOsting is angry with me. Only main.dart.js within some specific envs sent twice. I attached a screenshot of my Cloud Logger when the case happened. Same behaviour is shared through the envs listed above.
Hope this question reaches gurus in the community. Thank you in advance [:

Related

Flutter Firebase Authentication Email Templates 404 Page Not Found Error

ScreenShot
When I open the link in the email that is sent by Firebase Auth it self, I'm getting 404 Page Not Found screen. However, I have different web apps as well, and I don't have this problem with them. Only difference between this project and others is this project in Production mode.
Note: Site is working as expected, except email links (I'm not facing this 404 page if I just open my web site).
I run flutter doctor -v and there is no problem.
I have tried flutter clean but no result.
I have updated firebase packages but no result.

Flutter: wasm streaming compile failed: TypeError: Could not download wasm module

I'm building a Flutter web app. Everything was working fine until randomly I did a hot restart and then I began getting this error.
wasm streaming compile failed: TypeError: Could not download wasm module
Tried 2 things
Reverted the code back to a known working state (from git source control) and I still get this error.
Created NEW Flutter project from Android studio using New Flutter project options. Still did not work.
Any ideas? I tried to update Chrome and this did not help.
I lived in a remote area where no broadband is available so I use wireless network through sim card. The operator network is disturbing ,I can browse website sometimes and some times bit laggy on the other hand my flutter project work on emulator but I can not run it web. I changed the operator network and get a good quality of internet connection than The issue gone. What I think some module in web need to build good internet connection. I don't know this answer is helpful or not but this is how I solve my issue
It needs a stable internet connection to run. The error gone once I switched to good internet.

Service-worker.js not available in the for debugging in the chrome dev tools

I understand service-worker runs as a separate thread parallel to the main thread.
I have an android app that runs Webview. My app is in react and i use workbox strategies for caching.
Service worker updates everytime I do a new build. However the source file of service-worker.js is not available in the chrome dev tools for me to debug.
Any idea how i can get the file there so that i can put breakpoints and debug ?
PS: just few days before i could get the file for debugging the dev tools. I am not sure what has changed. I havent changed any settings the the browser.
I'm having the exact same problem with the same symptoms and timeframe. I tried everything I can think of and can no longer get remote debugging of a service worker running in an Android WebView to work.
Like you I am sure it was working in mid-February and stopped working in the last few weeks.
I submitted a bug to Google which you can find here.
I think we can only hope it will be fixed in an upcoming release of Chrome.
You can inspect your extension's service worker but it's tricky, I don't know why Chrome doesn't show the service worker in the default chrome extension devtools.
here is how you can do it:
open chrome://serviceworker-internals/?devtools
find your extension there, there is a textarea that shows console logs, every console log will show the extension path in chrome e.g.
Console: {"lineNumber":688,"message":"[crx-helper] connection error","message_level":3,"sourceIdentifier":3,"sourceURL":"chrome-extension://aobpjedackhiamobjolncblfckdgfjbk/background.bundle.js"}
get that sourceUrl chrome-extension://aobpjedackhiamobjolncblfckdgfjbk/background.bundle.js yours will have a different id, which you can also see in chrome://extensions
paste that path in a new tab and open devtools (screenshot).

MoPub GDPR SDK - how to test?

Hi I am setting up the MoPub GDPR Android SDK, am getting a call to the consent dialog page on the web but get this response :
05-16 11:10:46.469 13030-13152/ E/Volley: [18308] BasicNetwork.performRequest: Unexpected response code 400 for https://ads.mopub.com/m/gdpr_consent_dialog
This means "Bad Request" and that the call is corrupt I think. Has anyone got this call to work ?
This isn't an ideal solution, but it works.
On your test device install a VPN service app, there are lots of free ones available out there. If you're running in an emulator (or a device without Google Play) you can goto one of the many APK mirror sites to download and sideload the APK directly.
I won't get into the obvious risks of using VPNs, or sideloading apks outside of google play, but if you're paranoid just spin up an emulator to test this.
It's important the service offers VPN servers located in countries affected by GDPR.
Enable the VPN service on your device/emulator and make sure you're using a server located in a GDPR country (Germany, for example). Load up the app your testing, and it should now appear that you are accessing
Not sure why Pete is suggesting a VPN here. But it appears I was getting this error because I forgot to replace the AD_UNIT_ID in the SdkConfiguration.Builder with my Ad Unit ID.

Opening a URL in the AndroidTV emulator does not work, works fine on my AndroidTV box

I have made a small AndroidTV app that can query a rest api and present the content that it returns. This works without any issues when I am running the app on my Nexus Player with AndroidTV 7 (API 25).
To be able to work on the app, when I'm commuting I would like to be able to develop using the AndroidTV emulator. But when I run my app in the emulator I cannot access my api endpoints.
The emulator does have internet connectivity. In the AndroidTV emulator the "Videos" leanback sample is pre-installed. And that can access the internet and fetch the images from their endpoints.
The code I'm using currently looks like this:
final URL url1;
HttpURLConnection urlConnection = null;
try {
url1 = new URL(url);
urlConnection = (HttpURLConnection) url1.openConnection();
urlConnection.setUseCaches(true);
urlConnection.addRequestProperty("Cache-Control", "only-if-cached");
int maxStale = 60 * 60 * 10; // tolerate stale time in seconds
urlConnection.addRequestProperty("Cache-Control", "max-stale=" + maxStale);
return urlConnection.getInputStream();
} finally {...}
If I use the Google Videos sample resource URL's as input to the above code, I am able to fetch their resources, also when run in the emulator.
Requesting data from my own rest endpoint (also publicly available on the internet) gives a FileNotFoundException.
The urls that cause the exception can be access from my host machine without any problems.
One of the sample resources from the Videos leanback sample is this one:
http://commondatastorage.googleapis.com/android-tv/Sample%20videos/Demo%20Slam/Google%20Demo%20Slam_%20Extra%20Spicy/bg.jpg
The code above can fetch this resource without any problems both when running on the Nexus Player, and in the Emulator.
But it seems as though I cannot fetch resources from other domains than the googleapis.com domain.
I have checked and updated all Android tools to the latest versions. Including platform tools and system images.
I have also tried deleting all AVDs I had that might be outdated and created new ones - but no success.
I am starting the AVD with the "-dns-server 8.8.8.8,8.8.4.4" argument so that it should be able to do DNS lookups.
I might be mistaken, but it seems like the googleapis.com addresses have been whitelisted in the emulator somehow.
Is there some place or setting where I can whitelist my own URL, or similar way that I can get access to my api on the internet when running in the emulator?
Try to check the proxy on emulator settings. Another common issue: check the date/time of emulator. If old, then SSL will not work.
I forgot to update this.
It turned out to be a bug in the Android Emulator. Google fixed it about 6 months after the issue was reported. Or I guess they fixed it earlier than that, but it was not released to the public until 6 months later.