funkhaus/fuxt

New project - "Can't set headers after they are sent"

Closed this issue · 4 comments

Upon repo clone, npm install, changing .env vars and then running dev server. This error persistently pops up

ERROR: Error Can't set headers after they are sent.

Does anyone have any idea on why this is so persistent?

My GQL endpoint WP backend is using your fuxt-backend theme.

This is because a GraphQL error is occuring. It's probably because you didn't install ACF Pro? Can you include a screenshot of the entire error?

Just an FYI, how I trouble shoot these is by going to the GraphQL endpoint directly, like for example: https://api.funkhaus.us/graphql

And then if you see a PHP error there, then you know it's a server side error. If that loads with a JSON message about requiring a query, then chances are it's a frontend error.

Chances are the error is this:

Fatal error: Uncaught WPGraphQLGutenberg\Blocks\RegistryNotSourcedException: Client side block registry is missing. You need to open up gutenberg or load it from WPGraphQLGutenberg 

Basically just going to the GraphQL menu in the dashboard, then GraphQl Gutenberg and click the button on the page. It's some dumb stuff you have to do to pre-load Gutenberg to know about all the blocks it supports. #GutenbergSucks

I ran into this today I think. It was due to an old version of Node. I changed my package.json file to have this for my engines:

    "engines": {
        "node": "16.x"
    },

And then deleted my node_modules and package-lock and then npm i and it worked.