Microservice Response
AI-generatedOverview
The node, named "Microservice Response," is designed to send workflow results back to complete HTTP requests initiated by an Express Microservice Trigger in n8n. It acts as a responder that finalizes pending HTTP requests by sending either success or error responses based on the workflow's output or custom data.
This node is particularly useful in scenarios where you have an HTTP-triggered workflow that needs to asynchronously process data and then respond to the original HTTP request once processing is complete. For example, it can be used to:
- Complete an HTTP request after some background processing finishes.
- Send custom JSON responses back to clients calling an Express-based microservice.
- Signal success or failure of a request handled by a microservice trigger.
Properties
| Name | Meaning |
|---|---|
| Response Mode | How to identify which HTTP request to complete: - Auto (use requestId from trigger) - Manual (specify requestId) |
| Request ID | Specific request ID to complete when using Manual mode (e.g., "abc-123-def"). Required if Response Mode is Manual. |
| Response Data Source | What data to send as HTTP response: - Input Data (pass through the input JSON data) - Custom Data (send user-defined JSON) |
| Custom Response Data | Custom JSON data to send as HTTP response. Only shown if Response Data Source is Custom Data. Defaults to {"message": "Success", "status": "completed"}. |
| Success Status | Whether this represents a successful or failed response: - Success - Error |
Output
The node outputs an array with one item per input item. Each output item contains a JSON object with the following fields:
- All original input JSON fields passed through.
httpResponseSent: Boolean indicating whether the HTTP response was successfully sent.httpResponseStatus: Either"success"or"error"depending on the chosen status.httpRequestId: The request ID used to complete the HTTP request.responseData: The actual JSON data sent as the HTTP response.timestamp: ISO string timestamp of when the response was sent.- If an error occurs and
continueOnFailis enabled, the output includes:error: The error message.httpResponseSent: falsetimestamp: Timestamp of the failure.
The node does not output binary data.
Dependencies
- Requires an active Express Microservice Trigger node upstream that holds pending HTTP requests identified by request IDs.
- Uses internal functions to complete or fail HTTP requests (
completeHttpRequestandfailHttpRequest) provided by the microservice infrastructure. - No external API keys or credentials are required for this node itself.
- Proper configuration of the Express Microservice Trigger is necessary to generate and manage request IDs.
Troubleshooting
- No requestId found in input data: This error occurs if Response Mode is set to Auto but the input data does not contain a
requestIdfield or aworkflowContext.requestId. To fix, ensure the Express Microservice Trigger is connected and passing the requestId, or switch to Manual mode and specify the requestId explicitly. - Request ID is required when using Manual mode: When Response Mode is Manual, the Request ID property must be filled; otherwise, the node throws an error.
- Invalid JSON in Custom Response Data: If the Custom Response Data field contains invalid JSON, the node will throw an error. Validate the JSON syntax before saving.
- No pending HTTP request found for [requestId]: This warning means the request may have already been completed or timed out. Check that the requestId is correct and that the request has not expired.
- If the node fails but
continueOnFailis enabled, it outputs error details instead of stopping the workflow.