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:

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:

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 (<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:

Here’s the endpoint it’s hitting:

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.


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:

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

1 Like

Hey @mayer.georgep we have merged a fix into frontity:

You should now be receiving a 404 for any unknown urls and never a 500.

If your problem still persists, it would be helpful if you can share your frontity.settings.js file to diagnose it.

1 Like