GoogleChromeLabs / pwa-wp

WordPress feature plugin to bring Progressive Web Apps (PWA) to Core
https://wordpress.org/plugins/pwa/
GNU General Public License v2.0
615 stars 98 forks source link

404 pages #685

Open harryPAchievement opened 2 years ago

harryPAchievement commented 2 years ago

Looks like service worker is breaking pages. Installed fine to my wordpress website, after adding a core page, so domain/page_name, all core pages started going 404. After disabling plugin, this stopped happening. Its not the normal issue which is solved with permalinks. Any assistance or information about this is appreciated, thanks

westonruter commented 2 years ago

What do you mean by “after adding a core page”?

harryPAchievement commented 2 years ago

literally where you add pages, one of the core functions wordpress provides image

westonruter commented 2 years ago

So basically if you go to any URL of your site that isn't the homepage you get a 404?

I'd probably have to see the issue on a live site to be able to identify what's going on. I haven't seen that issue myself.

harryPAchievement commented 2 years ago

Well it is a closed site, and it doesn't always happen. It's irregular, but since I disabled the plugin, the logs only show the service worker calling 404

harryPAchievement commented 2 years ago

is there something in the plugin that lists all the pages or something like that?

westonruter commented 2 years ago

When the service worker is installed, it precached two pages, one for the offline.php template and another for the 500.php template. For example:

https://amp-wp.org/?wp_error_template=offline https://amp-wp.org/?wp_error_template=500

harryPAchievement commented 2 years ago

Thanks for taking the time to get back to me. So no directory for all of the pages? Also when do the manifest and offline files get created? Is it only on install of the plugin

westonruter commented 2 years ago

The offline/500 error templates are created at runtime. There are no files that are created. The manifest is served dynamically by the REST API.

harryPAchievement commented 2 years ago

Interesting, I have not had time to look further into it, but since i disabled it. The issue hasnt been raised again

harryPAchievement commented 2 years ago

Well today i have activated the plugin again, and already got a 404 page.

westonruter commented 2 years ago

Share the URL of your site where I can see the issue.

harryPAchievement commented 2 years ago

Its a closed site, so i cant do that. I will be looking into the actual reason when i have time. Will also post it here if it is a conflict or issue with the plugin.

harryPAchievement commented 2 years ago

By closed site, i mean you need a login to see the site.

Sasha15 commented 2 years ago

Good morning, guys. We faced with the same issue after upgrading plugin from version 0.5.0 to 0.6.0. New created pages from time to time return 404 error.
In our case reverting updates in file wp-includes/class-wp.php fix the problem. Here are the changes, which I am speaking about Also, returning to version 0.5.0 fixes the issue. Forking plugin isn't an option for us. Is it possible to do something? Thanks in advance.

westonruter commented 2 years ago

Specifically these changes?

image

I don't see why that would cause a 404. Can you share your Site Health information so I can try to replicate the issue?

Sasha15 commented 2 years ago

Thank you for a quick response @westonruter. Yes, reverting exactly this changes fix issue in our case. I agree that it is ridiculous and by my opinion simple rewriting rule could not affect. But probably, we have some complex problem. Here are our Website health report:

wp-core

version: 5.7.2 site_language: de_DE user_language: de_DE timezone: +02:00 permalink: /%postname%/ https_status: true multisite: false user_registration: 0 blog_public: 0 default_comment_status: closed environment_type: production user_count: 12 dotorg_communication: true

wp-paths-sizes

wordpress_path: /project/web/wp wordpress_size: 58,65 MB (61502961 bytes) uploads_path: /project/web/app/uploads uploads_size: 14,28 GB (15337347039 bytes) themes_path: /project/web/app/themes themes_size: 498,73 MB (522956185 bytes) plugins_path: /project/web/app/plugins plugins_size: 35,34 MB (37059914 bytes) database_size: 77,53 MB (81297408 bytes) total_size: 14,94 GB (16040163507 bytes)

wp-dropins (1)

db.php: true

wp-active-theme

name: BuddyBoss Child (buddyboss-theme-child) version: 1.0.0 author: BuddyBoss.com author_website: https://www.buddyboss.com/ parent_theme: BuddyBoss Theme (buddyboss-theme) theme_features: core-block-patterns, align-wide, menus, post-thumbnails, editor-style, buddypress-use-nouveau, automatic-feed-links, title-tag, html5, customize-selective-refresh-widgets, custom-logo, post-formats, woocommerce, job-manager-templates, widgets theme_path: /project/web/app/themes/buddyboss-theme-child

wp-parent-theme

name: BuddyBoss Theme (buddyboss-theme) version: 1.8.4.1 author: BuddyBoss author_website: https://www.buddyboss.com/ theme_path: /project/web/app/themes/buddyboss-theme

wp-mu-plugins (6)

Asset CleanUp Pro: Plugin Filtering: version: 1.0, author: Gabriel Livan Bedrock Autoloader: version: 1.0.1, author: Roots Disallow Indexing: version: 1.0.0, author: Roots LearnDash LMS Multisite: version: 1.0.0, author: LearnDash Loco Standalone Loader: version: 1.0, author: Tim Whitlock Register Theme Directory: version: 1.0.0, author: Roots

wp-plugins-active (6)

Advanced Custom Fields PRO: version: 5.11.4, author: Delicious Brains LearnDash LMS: version: 3.6.0.3, author: LearnDash LearnDash LMS - Course Grid: version: 1.7.0, author: LearnDash Loco Translate: version: 2.5.7, author: Tim Whitlock Pantheon Advanced Page Cache: version: 1.0.0, author: Pantheon Query Monitor: version: 3.8.2, author: John Blackbourn

wp-media

image_editor: WP_Image_Editor_GD imagick_module_version: Nicht verfügbar imagemagick_version: Nicht verfügbar file_uploads: File uploads is turned off post_max_size: 512M upload_max_filesize: 512M max_effective_size: 512 MB max_file_uploads: 20 gd_version: bundled (2.1.0 compatible) ghostscript_version: not available

wp-server

server_architecture: Darwin 20.4.0 x86_64 httpd_software: nginx/1.21.1 php_version: 7.3.33 64bit php_sapi: fpm-fcgi max_input_variables: 1000 time_limit: 300 memory_limit: 512M max_input_time: 60 upload_max_filesize: 512M php_post_max_size: 512M curl_version: 7.80.0 (SecureTransport) OpenSSL/1.1.1l suhosin: false imagick_availability: false pretty_permalinks: true

wp-database

extension: mysqli server_version: 5.7.23

wp-filesystem

wordpress: writable wp-content: writable uploads: writable plugins: writable themes: writable mu-plugins: writable 0: Writable

redux-framework

version: 4.3.1 installation: in_theme data directory: /project/web/app/themes/buddyboss-theme/inc/admin/framework/redux-core/ browser: Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36 Browser: Chrome Version: 97.0.4692.99 Platform: Apple

redux-instance-buddyboss_theme_options

opt_name: buddyboss_theme_options global_variable: buddyboss_theme_options dev_mode: true ajax_save: true page_slug: buddyboss_theme_options page_permissions: manage_options menu_type: submenu page_parent: buddyboss-settings compiler: true output: true output_tag: true templates_path: undefined extensions: Bb Typography: 1.0.4 Custom Image Select: 3.0.0 Customizer: 4.0.0 Import Export: 4.0.0 Options Object: 4.0.0 Repeater: 1.0.4

Hope it will help. Please let me know if I can provide anything else.

westonruter commented 2 years ago

So to confirm the behavior you're experiencing:

When you create a new page, accessing it will show the 404 template (404.php) as opposed to the expected page template (e.g. page.php). This doesn't happen for pages that you had previously created.

Do you get a 404 when you try to access new posts as well or only pages?

westonruter commented 2 years ago

@harryPAchievement In looking at @Sasha15's Site Health info, do you see any commonalities with your Site Health info? Anything that would be a common denominator?

westonruter commented 2 years ago

@Sasha15 In particular, I wonder if the problem is due to your permalink structure being /%postname%/. @harryPAchievement Is yours the same? Still I don't see why that would cause a 404 since the rewrite rule is added to the top.

westonruter commented 2 years ago

Also when the permalink structure begins with %postname% then WP Rewrite enables use_verbose_page_rules. So that may be another factor.

Sasha15 commented 2 years ago

@westonruter We are getting 404.php template instead of page.php or instead any other custom page templates. We experience such behaviour only for new created pages. Old ones work fine as well as all posts (old and new posts).

Also, as you suggested, probably problem is in /%postname%/. Switching to Simple permalink /?p=123 resolve the issue in our case.

Perhaps it doesn't matter, but I would like to notice that we are getting 404 not constantly. Pages are loading from time to time.

harryPAchievement commented 2 years ago

site health is mostly similar. ours is /%category%/%postname%/

I have removed the rewrite and that seems to have fixed it.

Our site is the same in the fact that "we are getting 404 not constantly. Pages are loading from time to time."

ankitrox commented 2 years ago

I've tried various combination of permalink with posts and pages creation with no luck to reproduce the problem.

System info

### wp-core ###

version: 5.9.1
site_language: en_US
user_language: en_US
timezone: +00:00
permalink: /%postname%/
https_status: true
multisite: false
user_registration: 0
blog_public: 0
default_comment_status: open
environment_type: production
user_count: 1
dotorg_communication: true

### wp-paths-sizes ###

wordpress_path: /var/www/html
wordpress_size: 46.81 MB (49079092 bytes)
uploads_path: /var/www/html/wp-content/uploads
uploads_size: 0.00 B (0 bytes)
themes_path: /var/www/html/wp-content/themes
themes_size: 8.72 MB (9148198 bytes)
plugins_path: /var/www/html/wp-content/plugins
plugins_size: 446.06 MB (467730288 bytes)
database_size: 2.64 MB (2768896 bytes)
total_size: 504.23 MB (528726474 bytes)

### wp-active-theme ###

name: Twenty Twenty (twentytwenty)
version: 1.9
author: the WordPress team
author_website: https://wordpress.org/
parent_theme: none
theme_features: core-block-patterns, widgets-block-editor, automatic-feed-links, custom-background, post-thumbnails, custom-logo, title-tag, html5, align-wide, responsive-embeds, customize-selective-refresh-widgets, editor-color-palette, editor-font-sizes, editor-styles, widgets, menus, editor-style
theme_path: /var/www/html/wp-content/themes/twentytwenty
auto_update: Disabled

### wp-themes-inactive (2) ###

Twenty Twenty-One: version: 1.5, author: the WordPress team, Auto-updates disabled
Twenty Twenty-Two: version: 1.1, author: the WordPress team, Auto-updates disabled

### wp-plugins-active (1) ###

PWA: version: 0.7.0-alpha, author: PWA Plugin Contributors, Auto-updates disabled

### wp-plugins-inactive (4) ###

Akismet Anti-Spam: version: 4.2.2, author: Automattic, Auto-updates disabled
Basic Site Caching: version: 0.1.4, author: Weston Ruter, Google, Auto-updates disabled
Hello Dolly: version: 1.7.2, author: Matt Mullenweg, Auto-updates disabled
PWA Extension: author: Ankit Gade, version: (undefined), Auto-updates disabled

### wp-media ###

image_editor: WP_Image_Editor_Imagick
imagick_module_version: 1691
imagemagick_version: ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.org
imagick_version: 3.6.0
file_uploads: File uploads is turned off
post_max_size: 8M
upload_max_filesize: 2M
max_effective_size: 2 MB
max_file_uploads: 20
imagick_limits: 
    imagick::RESOURCETYPE_AREA: 122 MB
    imagick::RESOURCETYPE_DISK: 1073741824
    imagick::RESOURCETYPE_FILE: 786432
    imagick::RESOURCETYPE_MAP: 512 MB
    imagick::RESOURCETYPE_MEMORY: 256 MB
    imagick::RESOURCETYPE_THREAD: 1
imagemagick_file_formats: 3FR, 3G2, 3GP, AAI, AI, APNG, ART, ARW, AVI, AVIF, AVS, BGR, BGRA, BGRO, BIE, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CR3, CRW, CUR, CUT, DATA, DCM, DCR, DCX, DDS, DFONT, DNG, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, FAX, FILE, FITS, FRACTAL, FTP, FTS, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, GROUP4, H, HALD, HDR, HEIC, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, J2C, J2K, JBG, JBIG, JNG, JNX, JP2, JPC, JPE, JPEG, JPG, JPM, JPS, JPT, JSON, K25, KDC, LABEL, M2V, M4V, MAC, MAGICK, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPG, MRW, MSL, MTV, MVG, NEF, NRW, NULL, ORF, OTB, OTF, PAL, PALM, PAM, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, POCKETMOD, PPM, PREVIEW, PS, PS2, PS3, PSB, PSD, PTIF, PWP, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, SUN, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIDEO, VIFF, VIPS, VST, WBMP, WEBM, WEBP, WMV, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, YCbCr, YCbCrA, YUV
gd_version: bundled (2.1.0 compatible)
gd_formats: GIF, JPEG, PNG, WebP, BMP
ghostscript_version: 9.53.3

### wp-server ###

server_architecture: Linux 5.13.0-30-generic x86_64
httpd_software: Apache/2.4.52 (Debian)
php_version: 7.4.28 64bit
php_sapi: apache2handler
max_input_variables: 1000
time_limit: 30
memory_limit: 128M
admin_memory_limit: 256M
max_input_time: -1
upload_max_filesize: 2M
php_post_max_size: 8M
curl_version: 7.74.0 OpenSSL/1.1.1k
suhosin: false
imagick_availability: true
pretty_permalinks: true
htaccess_extra_rules: false

### wp-database ###

extension: mysqli
server_version: 5.7.34
client_version: mysqlnd 7.4.28
max_allowed_packet: 4194304
max_connections: 151

### wp-constants ###

WP_HOME: undefined
WP_SITEURL: undefined
WP_CONTENT_DIR: /var/www/html/wp-content
WP_PLUGIN_DIR: /var/www/html/wp-content/plugins
WP_MEMORY_LIMIT: 40M
WP_MAX_MEMORY_LIMIT: 256M
WP_DEBUG: false
WP_DEBUG_DISPLAY: true
WP_DEBUG_LOG: false
SCRIPT_DEBUG: false
WP_CACHE: false
CONCATENATE_SCRIPTS: undefined
COMPRESS_SCRIPTS: undefined
COMPRESS_CSS: undefined
WP_ENVIRONMENT_TYPE: Undefined
DB_CHARSET: utf8
DB_COLLATE: undefined

### wp-filesystem ###

wordpress: writable
wp-content: writable
uploads: writable
plugins: writable
themes: writable
harryPAchievement commented 2 years ago

@Sasha15 and I both have the learndash plugin active

thelovekesh commented 2 years ago

@harryPAchievement Does deactivate the Learndash plugin and flushing permalinks solve the issue?

harryPAchievement commented 2 years ago

Its not an option to deactivate the learndash plugin, I removed the below code from the PWA plugin

Specifically these changes?

image

I don't see why that would cause a 404. Can you share your Site Health information so I can try to replicate the issue?

westonruter commented 2 years ago

I still have on my todo list to troubleshoot this. It may be a bit difficult to do if having the LearnDash plugin active is required, since it's a commercial offering.

Sasha15 commented 2 years ago

Thank you @westonruter. Unfortunately LearnDash is MU plugin for us.

westonruter commented 2 years ago

I've tried activating LearnDash and setting the permalink structure to /%postname%/ but I'm not seeing pages served back as 404, neither pre-existing pages nor newly-created pages.