question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read property 'slug' of undefined

See original GitHub issue

Bug Description

There have been reports of a Cannot read property 'slug' of undefined error, first occurring from 1.34.1. Based on one users experience this occurs when accessing the primary Site Kit dashboard. No additional insights available.

https://wordpress.org/support/topic/depannage-du-tableau-de-bord-google-kit-site/ - Open - No SH info https://wordpress.org/support/topic/site-kite-error/ - Open - No SH info https://wordpress.org/support/topic/site-kit-error-8 - Open - No valid SH info (User from another topic referenced this topic) https://wordpress.org/support/topic/error-site-kit-encountered-an-error - Resolved no specific action - SH Info provided https://wordpress.org/support/topic/fix-for-site-kit-encountered-an-error/ - Resolved Closed with no response from user - No SH info https://wordpress.org/support/topic/error-in-setup-wizard/#new-topic-0 - Resolved Unknown fix - SH info provided https://wordpress.org/support/topic/site-kit-encountered-an-error-45 - Open - No SH info yet

Console error from one impacted user - since resolved without any specific action

Failed to load resource: net::ERR_BLOCKED_BY_CLIENT
googlesitekit-vendor.346be2e029bd28ac57dd.js:1 TypeError: Cannot read property 'slug' of undefined
    at p (googlesitekit-dashboard.e2fb2513a57b6894e158.js:64)
    at WidgetAreaRenderer (googlesitekit-dashboard.e2fb2513a57b6894e158.js:120)
    at Ih (googlesitekit-vendor.346be2e029bd28ac57dd.js:1)
    at wi (googlesitekit-vendor.346be2e029bd28ac57dd.js:1)
    at ga (googlesitekit-vendor.346be2e029bd28ac57dd.js:1)
    at Zj (googlesitekit-vendor.346be2e029bd28ac57dd.js:1)
    at Lj (googlesitekit-vendor.346be2e029bd28ac57dd.js:1)
    at googlesitekit-vendor.346be2e029bd28ac57dd.js:1
    at t.unstable_runWithPriority (googlesitekit-vendor.346be2e029bd28ac57dd.js:1)
    at Mr (googlesitekit-vendor.346be2e029bd28ac57dd.js:1)
Pi @ googlesitekit-vendor.346be2e029bd28ac57dd.js:1
googlesitekit-dashboard.e2fb2513a57b6894e158.js:66 Caught an error: TypeError: Cannot read property 'slug' of undefined
    at p (googlesitekit-dashboard.e2fb2513a57b6894e158.js:64)
    at WidgetAreaRenderer (googlesitekit-dashboard.e2fb2513a57b6894e158.js:120)
    at Ih (googlesitekit-vendor.346be2e029bd28ac57dd.js:1)
    at wi (googlesitekit-vendor.346be2e029bd28ac57dd.js:1)
    at ga (googlesitekit-vendor.346be2e029bd28ac57dd.js:1)
    at Zj (googlesitekit-vendor.346be2e029bd28ac57dd.js:1)
    at Lj (googlesitekit-vendor.346be2e029bd28ac57dd.js:1)
    at googlesitekit-vendor.346be2e029bd28ac57dd.js:1
    at t.unstable_runWithPriority (googlesitekit-vendor.346be2e029bd28ac57dd.js:1)
    at Mr (googlesitekit-vendor.346be2e029bd28ac57dd.js:1) Object
value @ googlesitekit-dashboard.e2fb2513a57b6894e158.js:66
DevTools failed to load source map: Could not load content for https://*******/wp-content/plugins/log-cleaner-for-ithemes-security/css/log-cleaner.css.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

Additional Context

  • Started to occur from Site Kit 1.34.1
  • Possibly AMP related, with one user reporting the same in the AMP forums and captured SH info’s indicating the same.

Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • Rendering a widget area with no widgets should not raise any errors

Implementation Brief

Test Coverage

  • Tests are added to cover the changes to ensure the widget combination functions support no widgets given.

Visual Regression Changes

  • No changes

QA Brief

  • This one is difficult to QA and I was unable to reproduce it in the browser but it is specific to a widget area rendering with zero widgets – I’m guessing this might only be possible due to timing around when the area renders and when the widget registration happens since this is specifically zero total widgets for the area, not just active widgets.
  • See the comment on the issue where this was reproduced in a test after identifying combineWidgets as the source of the error https://github.com/google/site-kit-wp/issues/3618#issuecomment-892488288

Changelog entry

  • Fix potential “Cannot read property ‘slug’ of undefined” error on Site Kit screens.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
aaemnnosttvcommented, Aug 4, 2021

I was able to reproduce this error in a test, with the only condition being no widgets. Moving forward to execution as the fix is rather simple and will include this added test.

image

1reaction
jamesozziecommented, Jul 6, 2021

@bethanylang I think so. I’ll do a quick review and try to recreate the same environment before escalating.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read property 'slug' of undefined
javascript - TypeError: Cannot read property 'slug' of undefined - Stack Overflow. Stack Overflow for Teams – Start collaborating and sharing ...
Read more >
Cannot read property 'slug' of undefined · Issue #85 - GitHub
Hi. Got a problem with displaying accordion, no matter what I do I always end up with an : Uncaught TypeError: Cannot read...
Read more >
Cannot read property 'slug' of undefined - WordPress.org
This is the issue I am facing. I followed the instructions given above and tried troubleshooting also but it did not resolve my...
Read more >
Cannot read property 'slug' of null - Laracasts
I made condition to show div only if have link, but I get it an error Cannot read property 'slug' of null. Copy...
Read more >
Cannot read property 'slug' of undefined, but absolutely exist ...
[Solved]-Cannot read property 'slug' of undefined, but absolutely exist-node. js. You are accessing wrong the nested iterable object. You have defined articles ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found