Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postToConnection request does not timeout even if requestTimeout is set. #6896

Open
3 of 4 tasks
MAD-Scotty opened this issue Feb 19, 2025 · 0 comments
Open
3 of 4 tasks
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@MAD-Scotty
Copy link

Checkboxes for prior research

Describe the bug

When I try to post to a WebsocketMessage to my connections neither the postToConnection functions rejects an error nor it does resolves within the given requestTimeout. In the end I run into lambda timeout.

In some cases I have got lambda timeout for my lambda function which distributes messages to websocket connection. While debugging I added logging and found that in the cases the lambda times out the "Start sending connection.id" log is written but "Finished sending connection.id" log gets not written and for the same connection.id also the error log is not written. Therefore I assume the postToConnection function does not resolve or rejects even after the requestTimeout of 5sec is reached. The Lambda functions Timeout is set to 30sec.

`async sendMessage(connection: WebsocketConnection, message: WebsocketMessage) {
const data = new TextEncoder().encode(JSON.stringify(message));
const postParams: PostToConnectionCommandInput = {
ConnectionId: connection.id,
Data: data,
};

    try {
        logger.debug(`Start sending ${connection.id}`);
        await this.client.postToConnection(postParams, { requestTimeout: 5000 });
        logger.debug(`Finished sending ${connection.id}`);
    } catch (err) {
        logger.error(`Could not send to connectionId ${connection.id}`, err);
        await this.removeConnection(connection.id);
    }
}`

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

@aws-sdk/client-apigatewaymanagementapi@3.749.0

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

Node.js 20.x

Reproduction Steps

I do not not know why it appears, that the postToConnection function does not resolves or rejects.

Observed Behavior

Sometimes but not every time the postToConnection function does not resolve or reject.

Expected Behavior

I would expect postToConnection to reslove or reject at least after the requestTimeout is reached.

Possible Solution

No response

Additional Information/Context

No response

@MAD-Scotty MAD-Scotty added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

1 participant