Error in Capitalize

I get this error every time I use the built in wp apis. If I write my own handlers, everything works just fine. Am I doing something wrong?

ypeError: Cannot read property 'split' of undefined
    at __webpack_exports__.default (webpack-internal:///./node_modules/@frontity/wp-source/src/libraries/handlers/utils/capitalize.ts:2:73)
    at Object.eval (webpack-internal:///./node_modules/@frontity/wp-source/src/libraries/handlers/taxonomy.ts:9:300)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
    at eval (webpack-internal:///./node_modules/@frontity/wp-source/src/actions.ts:12:100)

This sounds like it might be a bug in frontity.

Could you share the URL of the wordpress rest api that you’re using so that I can verify it with a clean frontity project or test your API with the codesandbox or a clean frontity project using npx frontity create capitalizeError?

Sure thing. Here’s the WP dev endpoint: http://fall-line-capital.appspot.com/

Hi @mayer.georgep were you able to resolve the problem?

Which built in WP APIs were you referring to here :point_up_2:?

Hi - no, not yet. It’s any of the postType calls. Here’s the trace:

post
actions.ts?f1c8:56 TypeError: Cannot read property 'split' of undefined
    at __webpack_exports__.default (capitalize.ts?adee:3)
    at Object.eval (postType.ts?e855:50)
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (postType.ts:3)
    at _next (postType.ts:3)
    at eval (scheduler.js?f1c4:10)
    at batchedUpdates$1 (react-dom.development.js?61bb:24386)
    at batch (scheduler.js?f1c4:10)
    at batched (scheduler.js?f1c4:25)

Here’s the route:
frontity.actions.source.fetch("/stories/harvest-2019/")

Here’s the endpoint it’s hitting:
https://api.fall-line-capital.com/wp-json/wp/v2/posts?_embed=true&slug=harvest-2019

All seems to work just fine. Just hits a npe on that capitalize call. I’ve been overriding the handlers and that seems to work fine, but a bit of a pain.

thanks!

What are the /stories in your application? Is it a category? A tag? A custom postType?

@mayer.georgep In order to give you more effective support, It would be really helpful if you could provide us with a way to reproduce and/or debug the problem you’re facing :slight_smile:

Looks like this problem to me: https://github.com/frontity/frontity/issues/366

@mayer.georgep can you check it out and confirm?

1 Like