GraphQL return 200 on errors

Issue:
I built a workflow that should use post through buffer GraphQL API using the HTTP request node. Every execution was green but some post never showed up in buffer why?

Hey @white_hat, while you wait for a response, here are some things that might help:

Suggested resources

Automatically matched to your question.

Docs:

Forum:

@Niffzy, @barn4k, @tridi - you’ve helped with similar issues before, can you take a look?

Automatically suggested by n8n’s community bot. It’s a pilot - please share feedback here.

Hi @white_hat GraphQL returns HTTP 200 even on failure, and the error sits inside the response body, so n8n treats the request as successful.

Fix it in three steps:

  1. Add ... on MutationError { message } to your createPost query.
  2. In the HTTP node, set Options → Response → Never Error to on.
  3. Add a Code node that checks the body:
const body = $json.body ?? $json;
const post = body?.data?.createPost?.post;
return [{ json: {
  ok: !!post?.id,
  error: body?.errors?.[0]?.message || body?.data?.createPost?.message || null
}}];

Then route ok: false to an alert with an IF node.

Let me try this.

Hi @white_hat
A green execution only means the HTTP request itself completed successfully. It doesn’t necessarily mean Buffer actually published the post.

I’d check the GraphQL response from the HTTP Request node instead of relying only on the HTTP status. For example, you can use a Code node after the request to catch GraphQL errors:

const response = $json;
if (response.errors?.length) {
  throw new Error(
    `Buffer GraphQL error: ${response.errors
      .map(e => e.message)
      .join(', ')}`
  );
}
const post = response.data?.createPost;
if (!post) {
  throw new Error('Buffer did not return a created post.');
}
return [{
  json: {
    success: true,
    postId: post.id,
    status: post.status,
  }
}];

I’d also log the returned postId and status so you can tell whether Buffer actually accepted the mutation. If Buffer returns an error or an unexpected response, send that branch into a retry/error workflow rather than letting the execution stay green.

Thank you guyz for quick response. The issue is resolved now.