N8n chat node unable to fetch previous chat data from memory

500 Internal Server Error When Refreshing Chatbot embed Webpage

500 Internal Server Error When Refreshing Chatbot embed Webpage

I’m encountering a 500 internal server error when I refresh the webpage that should fetch messages from my chatbot workflow. The error prevents the messages from being loaded correctly.

Workflow Details:

  • Node Configuration:

  • Redis Chat Memory

  • Vector Store (Qdrant)

  • Ollama Model and Ollama Embeddings

  • JavaScript Code (PrepareChunks)

  • Aggregate

  • AnswerEngine

  • SetOutput

  • Chat Trigger

Steps to Reproduce:

  1. Setup the workflow as described.
  2. Load the chatbot webpage and interact with the bot.
  3. Refresh the webpage to fetch messages again.

Expected Behavior:

Messages should be fetched and displayed correctly upon refreshing the webpage.

Actual Behavior:

A 500 internal server error occurs, preventing messages from being fetched.

Troubleshooting Steps Taken:

  1. Verified Redis Chat Memory node configuration and Redis instance connectivity.

  2. Checked JavaScript code in PrepareChunks for errors and added additional checks:

    let out = “”;

    for (const i in $input.all()) {
    const item = $input.all()[i];
    if (item.json.document && item.json.document.pageContent && item.json.score >= 0.12) {
    out += ${i} ---\n${item.json.document.pageContent}\n\n;
    }
    }

    return {
    ‘context’: out
    };

  3. Reviewed connections and data flow between nodes.

  4. Inspected Aggregate node configuration.

  5. Monitored server logs for detailed error messages.

  6. Simplified the workflow by disabling some nodes to isolate the issue.

  • The issue appears to be related to the Chat Memory node or the data flow between nodes.
  • API keys and credentials have been verified to be correct.

Request for Assistance:

Any insights or suggestions on how to resolve this issue would be greatly appreciated. Specifically, guidance on identifying the root cause of the 500 internal server error and ensuring the messages are fetched correctly upon refreshing the webpage would be helpful.

Thank you!

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @sankalp-kalangutkar

Can you share your workflow and any error logs/screenshots?
How are you hosting n8n?

You can share your workflow here by pasting them as JSON in between two block quotes (```).

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.