Skip to content

Fix issue #78: jwtMiddleware throws at startup #315

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rido-min
Copy link
Member

@rido-min rido-min commented May 19, 2025

Add error handling in verifyToken function in jwt-middleware.ts to catch and log errors from ServerResponse.setHeader.

  • Catch and log errors in verifyToken function
  • Throw the caught error to propagate it further

For more details, open the Copilot Workspace session.

Add error handling in `verifyToken` function in `jwt-middleware.ts` to catch and log errors from `ServerResponse.setHeader`.

* Catch and log errors in `verifyToken` function
* Throw the caught error to propagate it further

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/microsoft/Agents-for-js?shareId=XXXX-XXXX-XXXX-XXXX).
@Copilot Copilot AI review requested due to automatic review settings May 19, 2025 16:33
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances error handling in the verifyToken function to catch, log, and rethrow errors during JWT verification.

  • Added a .catch block on the Promise returned by verifyToken to log errors.
  • Ensures errors are propagated after logging.
Comments suppressed due to low confidence (1)

packages/agents-hosting/src/auth/jwt-middleware.ts:64

  • Add a unit test covering the error path in verifyToken to verify that errors are properly logged and rethrown.
logger.error('Error in verifyToken: ', err)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant