Skip to content

Excel Generator /generate endpoint throws error when excelConfigs missing; TypingMind UI omits this field #106

@mmynsted

Description

@mmynsted

Describe the Bug

When using the Excel Generator server plugin (/excel-generator/generate endpoint) with the standard TypingMind personal (license) app, the plugins-server throws an error if the excelConfigs field is missing from the request body. However, TypingMind’s built-in Excel Generator plugin only sends the sheetsData field and does not provide excelConfigs.

As a result, the server returns a 500 error, and the plugin cannot be used without code modification.

Steps to Reproduce

  1. Deploy plugins-server from main branch (latest).
  2. In TypingMind, set the Excel Generator's Plugin Server setting to point to the deployed server (e.g. http://localhost:3000/excel-generator). Replace localhost with the actual ip address, if applicable.
  3. In chat, trigger the Excel Generator plugin with a prompt like "Create an Excel file with a ‘Sales’ sheet".
  4. Observe: Internal server error (500) is returned by /excel-generator/generate, and the plugin does not produce a file.

Here is the docker-compose I am using to run the plugin server. (I redacted the IP address.)

version: '3.8'

services:
  plugin-server:
    build: .
    ports:
      - "3000:3000"
    restart: unless-stopped
    volumes:
      - ./data:/app/data 
    environment:
      - PUBLIC_HOST=http://redacted:3000
  1. Plugin: Excel Generator
  2. Actions: Attempt to generate any excel file.
  3. Configuration: Configure with defaults.

Expected Behavior

  • The plugins-server should gracefully handle cases where excelConfigs is missing or undefined (treating it as {}).
  • Users should be able to use the Excel Generator plugin in TypingMind without supplying excelConfigs (keeping backwards compatibility).

** Proposed fix **

In /src/routes/excelGenerator/:

  • Change code to default excelConfigs to an empty object if missing:
    const excelConfigs = body.excelConfigs ?? {};

Environment Information

  • TypingMind Proxy Version: Main, hash 8af113f1a42.
  • Plugin Name and Version: Excel Generator, hosted version is from the plugin sever main, hash 8af113f1a42.
  • Operating System: Host from uname is Linux amber 5.10.0-34-amd64 #1 SMP Debian 5.10.234-1 (2025-02-24) x86_64 GNU/Linux
  • Browser (if applicable): Firefox 138.0.4 (aarch64)
  • Other Relevant Software: TypingMind Latest version running in Firefox as of 2025-05-26.

Visuals (Optional but Helpful)

  • Screenshots:
Image
  • Code Snippets: Here is what is sent to the server, reproduced using curl. The ip address is redacted.
curl -X 'POST' \
  'http://redacted:3000/excel-generator/generate' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{"sheetsData":[{"sheetName":"Sales Report","tables":[{"columns":[{"name":"Product","type":"string"},{"type>   'http://redacted:3000/excel-generator/generate' \
>   -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{"sheetsData":[{"sheetName":"Sales Report","tables":[{"columns":[{"name":"Product","type":"string"},{"type":"number","name":"Quantity"},{"name":"Price","type":"currency","format":"$#,##0.00"}],"rows":[[{"type":"static_value","value":"Product A"},{"type":"static_value","value":"10"},{"type":"static_value","value":"5.99"}],[{"type":"static_value","value":"Product B"},{"type":"static_value","value":"5"},{"type":"static_value","value":"12.50"}]],"title":"Sales Data","startCell":"A1"}]}]}'
>   -H 'Content-Type: application/json' \
>   -d '{"sheetsData":[{"sheetName":"Sales Report","tables":[{"columns":[{"name":"Product","type":"string"},{"type":"number","name":"Quantity"},{"name":"Price","type":"currency","format":"$#,##0.00"}],"rows":[[{"type":"static_value","value":"Product A"},{"type":"static_value","value":"10"},{"type":"static_value","value":"5.99"}],[{"type":"static_value","value":"Product B"},{"type":"static_value","value":"5"},{"type":"static_value","value":"12.50"}]],"title":"Sales Data","startCell":"A1"}]}]}'
{"success":false,"message":"Error Cannot read properties of undefined (reading 'fontFamily')","responseObject":"Sorry, we couldn't generate excel file.","statusCode":500}

Additional Context

  • Error Messages:
{"level":50,"time":1748311896837,"pid":31,"hostname":"e65d9d431da0","request":{"id":"eb70695f-fd88-4bf6-9ed0-62e24f67790d","method":"POST","url":"/excel-generator/generate",...},"response":{"statusCode":500,"headers":{...}},"error":{"type":"Error","message":"failed with status code 500","stack":"Error: failed with status code 500\n    at onResFinished ..."},"timeTaken":11,"msg":"request errored with status code: 500"}

Basically: Error Cannot read properties of undefined (reading 'fontFamily')

  • Impact: Causes the Excel plugin to fail using default values and exiting code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions