n8n icon indicating copy to clipboard operation
n8n copied to clipboard

fix(core): Map NodeOperationErrors to BadRequestError in /resource-locator-results

Open tomi opened this issue 2 months ago • 0 comments

Summary

While investigating https://linear.app/n8n/issue/ADO-1361/dynamic-options-fail-to-load-if-the-node-contains-an-expression-in-an I noticed this:

UI calls the /dynamic-node-parameters/resource-locator-results endpoint to resolve resources to show in the NDV resource picker. For example the user can select an n8n workflow from a list in the n8n node. However, if the credentials are invalid or missing, the resolution will throw a NodeOperationError. This results in HTTP 500 response from the endpoint. Since this is an expected error due to invalid configuration, it makes more sense to respond with 400 Bad Request.

Related tickets and issues

https://linear.app/n8n/issue/ADO-1361/dynamic-options-fail-to-load-if-the-node-contains-an-expression-in-an

Review / Merge checklist

  • [ ] PR title and summary are descriptive. Remember, the title automatically goes into the changelog. Use (no-changelog) otherwise. (conventions)
  • [ ] Docs updated or follow-up ticket created.
  • [ ] Tests included.

    A bug is not considered fixed, unless a test is added to prevent it from happening again. A feature is not complete without tests.

tomi avatar Apr 05 '24 13:04 tomi