Skip to content

Conversation

ongdisheng
Copy link
Contributor

@ongdisheng ongdisheng commented Oct 3, 2025

Summary

This PR fixes an issue where GraphQL errors would appear in both the success and error outputs when using the "Continue using error output" setting. The problem occurred because the node was adding the GraphQL response to returnItems before checking for errors. This fix moves the error checking logic before adding items to returnItems, ensuring that GraphQL errors are only routed to the error output and successful responses only go to the success output.

Screenshot

image image

Related Linear tickets, Github issues, and Community forum posts

Closes #20321

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 3 files

Prompt for AI agents (all 2 issues)

Understand the root cause of the following 2 issues and fix them.


<file name="packages/nodes-base/nodes/GraphQL/GraphQL.node.ts">

<violation number="1" location="packages/nodes-base/nodes/GraphQL/GraphQL.node.ts:519">
The fix to prevent duplicate error outputs introduces a regression where GraphQL errors are no longer handled when the &#39;Response Format&#39; is set to &#39;String&#39;. The error detection logic is now skipped for string-based responses, causing them to be incorrectly routed to the success output.</violation>

<violation number="2" location="packages/nodes-base/nodes/GraphQL/GraphQL.node.ts:537">
Rule violated: **Prefer Typeguards over Type casting**

Prefer Typeguards over Type casting §1: instead of casting `response.errors` to JsonObject, validate the GraphQL error payload (e.g., ensure it’s an array of JSON objects and wrap it in a JsonObject) before constructing `NodeApiError`.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

@n8n-assistant n8n-assistant bot added community Authored by a community member node/improvement New feature or request in linear Issue or PR has been created in Linear for internal review labels Oct 3, 2025
@Joffcom
Copy link
Member

Joffcom commented Oct 3, 2025

Hey @ongdisheng,

Thank you for your contribution. We appreciate the time and effort you’ve taken to submit this pull request.

Before we can proceed, please ensure the following:
• Tests are included for any new functionality, logic changes or bug fixes.
• The PR aligns with our contribution guidelines.

Regarding new nodes:
We no longer accept new nodes directly into the core codebase. Instead, we encourage contributors to follow our Community Node Submission Guide to publish nodes independently.

If your node integrates with an AI service that you own or represent, please email [email protected] and we will be happy to discuss the best approach.

About review timelines:
This PR has been added to our internal tracker as "GHC-4815". While we plan to review it, we are currently unable to provide an exact timeframe. Our goal is to begin reviews within a month, but this may change depending on team priorities. We will reach out when the review begins.

Thank you again for contributing to n8n.

cursor[bot]

This comment was marked as outdated.

@ongdisheng
Copy link
Contributor Author

@cubic-dev-ai review this PR

Copy link
Contributor

cubic-dev-ai bot commented Oct 3, 2025

@cubic-dev-ai review this PR

@ongdisheng I've started the AI code review. It'll take a few minutes to complete.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Authored by a community member in linear Issue or PR has been created in Linear for internal review node/improvement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GraphQL node sends output to both Error and Success
2 participants