Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packaging fails when "Offline browsing" enabled in WordPress #4641

Closed
jessuppi opened this issue Jan 31, 2024 · 4 comments
Closed

Packaging fails when "Offline browsing" enabled in WordPress #4641

jessuppi opened this issue Jan 31, 2024 · 4 comments

Comments

@jessuppi
Copy link

What's your suggestion for improvement for our docs?

I don't think this is a bug, it's probably happening for a reason. I have seen dozens of Issues about PWABuilder failing to package the Android app with various 500 errors or APK related errors e.g.

Error: Error generating Android package.
Status code: 500
Error: Internal Server Error
Details: Error generating app package:
invalid json response body at ..... reason: Unexpected token < in JSON at position 0
stack: FetchError: invalid json response body at ..... reason: Unexpected token < in JSON at position 0

Anyway, our community at SlickStack recently discovered this happens on WordPress sites when the "Offline browsing" feature is enabled under Settings >> Reading.

After disabling that feature, the Android package downloads with no more problems.

Ref: https://slickstack.io/forum/topic/cant-generate-pwa-package-from-pwabuilder-many-errors

I just wanted to let you guys know, for future Googlers etc.

Do you have an implementation or a solution in mind?

No response

Have you considered any alternatives?

No response

@jessuppi jessuppi changed the title Packaging the PWA fails when "Offline browsing" enabled in WordPress Packaging fails when "Offline browsing" enabled in WordPress Jan 31, 2024
@jessuppi
Copy link
Author

jessuppi commented Jan 31, 2024

Possibly related issues linked below, at least other developers might land on them trying to debug this... I see dozens of others too, however just trying to get this Issue a bit of visibility.

#4640, #2219, #697, #397, #1365, #1418, #2123, #1375, #1935, #1132, #4558, #1610, #2712, #1266

@jgw96
Copy link
Contributor

jgw96 commented Feb 5, 2024

Hey @jessuppi do you have an example web manifest that this wordpress plugin generates? It sounds like it is not valid JSON from the error, but this would help us confirm.

@jessuppi
Copy link
Author

jessuppi commented Feb 6, 2024

@jgw96

For the semi-official PWA plugin released by WordPress.org, the manifest URL is here:

/wp-json/wp/v2/web-app-manifest

I ran a few tests, with the Offline browsing option both enabled and disabled but the JSON output appeared the same. It could be a coincidence during my tests, maybe previously the output was NOT the same, but unlikely:

{"name":"Example Site","start_url":"https:\/\/example.com\/","display":"minimal-ui","dir":"ltr","short_name":"Example","lang":"en-US","background_color":"#fff","theme_color":"#fff","description":"My website is about cats","icons":[{"purpose":"any","src":"https:\/\/example.com\/wp-content\/uploads\/sites\/4\/2023\/12\/cropped-logo-512-192x192.png","sizes":"192x192","type":"image\/png"},{"purpose":"any","src":"https:\/\/example.com\/wp-content\/uploads\/sites\/4\/2023\/12\/cropped-logo-512.png","sizes":"512x512","type":"image\/png"}]}

It validates fine on JSONLint too.

The JSON output appears minified, but I think that is from Cloudflare. In any regard, the minification didn't seem to hurt anything because on subsequent attempts, PWA Builder packaging worked fine.

By the way, it might be related, I saw the problem on a WordPress Multisite installation. I haven't found any documentation or similar experiences to mine, so just wanted to share. The HTTP headers also appear to be the same both with Offline browsing enabled and disabled.

@jgw96
Copy link
Contributor

jgw96 commented Feb 12, 2024

Ahhhh, you mentioned Cloudflare, yeah this is probably minified from them. Another weird thing I noticed is those icon URLs don't seem to load correctly in my browser. Thanks for sharing this info, I am going to close this issue for now as you mentioned its working for you now, but again, thanks for the info!

@jgw96 jgw96 closed this as completed Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants