Skip to content

[WEBJS] - GET /api/:session/lids/:lid can return HTTP 500 instead of a safe null result` #1986

@gsx1000rr

Description

@gsx1000rr

Describe the bug

On WEBJS, GET /api/:session/lids/:lid can return HTTP 500 during LID-to-phone resolution.

This looks like a WAHA-layer issue because the WEBJS implementation does not handle this path as defensively as the other LID-related methods.

Version

{
"version": "2026.3.2",
"engine": "WEBJS",
"tier": "PLUS"
}

Steps
Use a WEBJS session that is connected/WORKING.
Call GET /api/:session/lids/:lid.
Sometimes the endpoint returns HTTP 500 instead of a safe result.
Expected behavior
If the mapping is unavailable or not ready, the endpoint should return a safe response such as pn: null, or fail in a controlled/non-500 way.

Requests - Responses
Example request:

GET /api//lids/@lid
Example response shape from logs:

{
"statusCode": 500,
"exception": {
"stack": "... WebjsClientPlus.findPNByLid ... LidsController.findPNByLid ..."
}
}

Additional context
In the WEBJS implementation:

getAllLids() calls warmUpAllLidPnMappings()
getLidsCount() also calls warmUpAllLidPnMappings()
but findPNByLid() does not
findPNByLid() also directly calls window.Store.LidUtils.getPhoneNumber(wid) without defensive checks.

patron:PLUS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions