Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Webhook Response" does not respect the given Response #7077

Closed
oalexdoda opened this issue Sep 2, 2023 · 12 comments
Closed

"Webhook Response" does not respect the given Response #7077

oalexdoda opened this issue Sep 2, 2023 · 12 comments
Labels
in linear Issue or PR has been created in Linear for internal review Released

Comments

@oalexdoda
Copy link

oalexdoda commented Sep 2, 2023

Describe the bug

I'm using IF conditionals to make sure HTTP requests are processed correctly. If they aren't, I want to submit a response in a specific format, as seen below.

image

For some reason, when it errors out it won't respect that JSON response. Instead, it will simply pass its input forward.

image

To Reproduce
Steps to reproduce the behavior:

  1. Create a webhook listener and bunch of nodes
  2. Set up a webhook response with a custom JSON response body
  3. Test the workflow
  4. See the error

Expected behavior

The webhook response should send the custom response instead of its input.

Environment (please complete the following information):

  • OS: Ubuntu (Latest Docker Image - DigitalOcean)
  • n8n Version: 1.4.0
  • Node.js Version: (N/A - Docker Image - DigitalOcean)
  • Database system: SQLite
  • Operation mode: main
@Joffcom
Copy link
Member

Joffcom commented Sep 3, 2023

Hey @altechzilla

Good spot it looks like the node was created to pass on the input rather than what the node is configured to return for the webhook.

I will get a ticket created for this but it will possibly be a breaking change so we will need to think about the best way to change this, it could be that we add an option to output the node message.

@oalexdoda
Copy link
Author

Hey @Joffcom , it actually already has an option to be set as None. Which I assume is the default for the node. But for some reason even if you do select JSON it won't respect it. Thank you for having a look into it!

@Joffcom
Copy link
Member

Joffcom commented Sep 4, 2023

Hey @altechzilla,

As far as I know that node doesn't have an option and it will always pass on the input items, Maybe I have missed something here though...

Just to check this issue is around the output of the node itself and not the actual response the webhook node returns right?

@oalexdoda
Copy link
Author

Hmm... You might be right—in the sense that I mistook the output for what the response was expected to be. Perhaps there could be a toggle that says "Set output to response" if the webhook response is set to JSON.

@Joffcom
Copy link
Member

Joffcom commented Sep 4, 2023

@altechzilla that is what I am thinking although the question then is... does that make this a bug or a feature request which isn't handled here?

@oalexdoda
Copy link
Author

Let's close this for now and I'll try it again later to make sure it's an actual bug - thank you!

@oalexdoda
Copy link
Author

Hey @Joffcom , not sure if this is related but here's what happens when trying to send a JSON:

https://share.abruptive.com/o0uKbJPn

https://share.abruptive.com/2NuWdpP6

Even thought he node was ran and the input is good, the response body is good, but the node errors out on the output side.

@oalexdoda
Copy link
Author

Just confirmed @Joffcom that the node does not respect the JSON response it's configured with, unless it's set to "First Node". If you set it to JSON, it will not follow through on execution:

  1. Here's how it's set up in the editor (with validated JSON): https://share.abruptive.com/v1un57yr
  2. Here's how it behaves on an actual run: https://share.abruptive.com/2NuWdOAn
  3. Here's the webhook response in Postman: https://share.abruptive.com/v1un57mr

@oalexdoda oalexdoda reopened this Sep 5, 2023
@Joffcom
Copy link
Member

Joffcom commented Sep 5, 2023

Hey @altechzilla,

I can see the problem now, We expect the JSON to still be a string and not a JSON object which is why it is failing. To fix this try...

{{ JSON.stringify({ your json }) }}

I have created NODE-750 as the internal dev ticket to automatically stringify the data if it is an object.

@Joffcom Joffcom added the in linear Issue or PR has been created in Linear for internal review label Sep 5, 2023
@oalexdoda
Copy link
Author

Epic!

michael-radency added a commit that referenced this issue Sep 28, 2023
Github issue / Community forum post (link here to close automatically):
#7077
@janober
Copy link
Member

janober commented Sep 28, 2023

Fix got released with [email protected]

@Joffcom
Copy link
Member

Joffcom commented Oct 9, 2023

Hey @altechzilla,

Great news, This has been fixed and released :) for now I am going to mark this as closed. Let me know if you have any other questions on this issue.

@Joffcom Joffcom closed this as completed Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in linear Issue or PR has been created in Linear for internal review Released
Projects
None yet
Development

No branches or pull requests

3 participants