Skip to content

[Bug] Validate LINE WORKS config before trying to send the oversize-message reply #42

Description

@shaaravraghu

Description

The /callback handler sends an overlength warning message before it checks whether LINE WORKS configuration is complete. If any required LINE WORKS credential is missing, the "message too long" path can raise inside send_message() and return 500 instead of handling the request cleanly.

Component

  • Chat Connector
  • Flowise Flow
  • Demo MCP Server
  • Documentation
  • Other

Steps to Reproduce

  1. Leave one or more required LINE WORKS credentials unset.
  2. POST a webhook payload containing a text body longer than MAX_MESSAGE_LENGTH.
  3. Observe that the handler reaches lw_client.send_message(...) before it reaches lw_client.validate_config().

Expected Behavior

Configuration should be validated before any outbound LINE WORKS API call, including the oversize-message branch.

Actual Behavior

The branch at routes.py:77-87 tries to send a reply first, while config validation does not happen until routes.py:89-91.

Environment

  • OS: Any
  • Python version: Source analysis
  • Docker version: N/A
  • Chat platform: LINE WORKS
  • Flowise version: N/A

Logs

Relevant code paths:
- chat-connector/app/routes.py:77-91
- chat-connector/app/services/lineworks.py:121-130

Additional Context

This is subtle because the normal success path validates config, but the oversize-message guard does not.

Evidence

Suggested fix

  • Move validate_config() ahead of all send_message() calls
  • Or short-circuit the oversize path with a logged 500/503 when the connector is misconfigured

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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