TypeError: Cannot read property 'length' of undefined
See original GitHub issueIssue Description
I just installed a fresh instance of WP and the starter.
The home page pulls up no problem but…
For some reason when I click on a post I am getting this error.
Server Error TypeError: Cannot read property ‘length’ of undefined
` 147 | 148 | const { categories, postId } = post;
149 | const category = categories.length && categories[0]; | ^ 150 | let { name, slug } = category; 151 | 152 | return {`
I have not added anything else to the starter (other than the graphql endpoint). I have not added any posts new posts. I added only one additional category for testing.
Is there a step I am missing?
Here is the WP install: http://newtechmachinery.kinsta.cloud/
thanks
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Cannot read properties of undefined (reading 'length') - TrackJS
TypeError is a subset of JavaScript Error that is thrown when code attempts to do something that does not exist on the target...
Read more >Typeerror: Cannot Read Property 'length' of Undefined
A typeerror length of undefined can indicate that the actual type of an operand is different from the expected type. This error can...
Read more >[SOLVED] Cannot Read Property 'length' of Undefined in JS
To fix the “cannot read property 'length' of undefined” error, perform an undefined check on the variable before accessing the length property ......
Read more >Cannot read property length of undefined - Stack Overflow
The error means that what ever element is returned by getElementById('WallSearch') , it does not have a value property. Every form field has...
Read more >TypeError: Cannot read property 'length' of Undefined in JS
The "Cannot read property 'length' of undefined" error occurs when accessing the length property on an undefined value. To solve the error, make...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Fixed via #156
Very happy to do this.
Confirmed with the WPGraphQL team that this was an issue.