GET fails when compiled to AAB and downloaded from Playstore

I am doing a GET request to download new puzzles in my game. It works in preview and if I put i Share it with browser https://semaggames.nl/Kyklolexo/ But when I make a aab from it with cordova put in the playstore and download it there it will not download the puzzle anymore. I get TypeError: Failed to fetch content. It can not fetch the content. Does anybody know what would make this happen?

The AAB is probably not the cause. An app bundle does not change how the WebView talks to the network. What changed is the environment: in preview you are on the editor’s dev server, in the browser share you are on a normal web origin, and in the installed app the game is loaded from a local origin (file://, or https://localhost on newer Cordova). Anything your code resolves against that origin, or anything the server only allows for some origins, breaks exactly like this.

TypeError: Failed to fetch is the generic error the fetch API throws for every network failure: DNS, connection refused, blocked cleartext, CORS rejection, missing permission. So read the real error before changing anything.

See the actual error (2 minutes)

  1. Build a debug build (not the Play Store AAB) and install it over adb. Debug builds normally have WebView debugging enabled.
  2. Connect the phone with USB debugging on, open chrome://inspect in desktop Chrome, inspect the WebView.
  3. Reproduce the GET and read the Console and Network tabs. The Network tab names the cause: net::ERR_CLEARTEXT_NOT_PERMITTED, a CORS message, ERR_CONNECTION_REFUSED, or a 404 on a URL you did not expect to be called.

The three causes that fit your symptoms

  1. Cleartext HTTP is blocked. Android 9+ refuses plain http:// by default. If your puzzle URL starts with http://, that is the whole bug. Serve it over https://. If you cannot, add a network security config for that one domain instead of turning on usesCleartextTraffic globally.

  2. The URL is relative. If it is built from a path like puzzles.json or /api/..., or from window.location, then in the app it resolves against the local origin and hits nothing. It worked in preview because there it resolved against the dev server. Log the exact URL string right before the fetch and make it absolute.

  3. CORS. A cross-origin GET from the app’s local origin needs Access-Control-Allow-Origin for that origin. A browser share can work because the server allowlists the share domain or reflects Origin. Test the server directly:

curl -i -H "Origin: https://localhost" "https://your-host/puzzles.json"

If the response has no Access-Control-Allow-Origin, that is your failure in the app.

Worth ruling out in 30 seconds: the merged manifest must contain android.permission.INTERNET. If a plugin or a custom config stripped it, every request fails the same way.

Paste the Console and Network lines from the WebView and I will tell you which of the three it is.

I am almost certain the issue is related to CORS. If you own the hosting, you need to create a PHP file to handle the requests and return the required JSON; you also need to add header("Access-Control-Allow-Origin: *"); at the beginning of the script to disable CORS. Alternatively, instead of *, enter all allowed domains, including https://localhost/

I think this was it too. but unfortunatly it was not. curl -I -H “Origin: https://localhost” https://semaggames.nl/Kyklolexo/puzzles/1.json gives back HTTP/1.1 200 OK
Date: Sun, 20 Sep 2026 09:42:27 GMT
Server: Apache
Last-Modified: Tue, 15 Sep 2026 10:02:13 GMT
ETag: “295-65b82a50ce7a3”
Accept-Ranges: bytes
Content-Length: 661
Access-Control-Allow-Origin: *
Cache-Control: no-cache, must-revalidate, stale-if-error=60
Content-Type: application/json Which is correct.

I have decided to put the puzzles directly in memory. It was a nice experiment but I think it might have to do with some security issues in the playstore or something. The ROI is not big enough to investigate deeper for me. I would have to make an debug APK etc because I debugged the playstore version with adb.exe and could not find more information than I allready had. Thanks for the ideas.