Skip to content

Conversation

@morris-kelly
Copy link

@morris-kelly morris-kelly commented Oct 20, 2025

Fixes #118 and fixes #125 and fixes #126.

Adds a test case to ensure that this is correct.

@morris-kelly
Copy link
Author

@Skitionek does this address the three issues and deal with the error in the failure?

Copy link
Owner

@Skitionek Skitionek left a comment

Choose a reason for hiding this comment

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

Thank you for contribution.

It looks good to me, I will try to find the time over weekend to merge and release this fix.

src/MSTeams.js Outdated
Comment on lines 293 to 309
// Create a safe representation of the response to avoid circular reference errors
const safeResponse = {};

// Safely copy properties, handling potential circular references
try {
safeResponse.status = response?.status;
safeResponse.statusText = response?.statusText;
safeResponse.headers = response?.headers ? JSON.parse(JSON.stringify(response.headers)) : undefined;
safeResponse.data = response?.data ? JSON.parse(JSON.stringify(response.data)) : undefined;
} catch (circularError) {
// If we still hit circular references, just include basic info
safeResponse.status = response?.status;
safeResponse.statusText = response?.statusText;
safeResponse.error = 'Response contained circular references';
}

throw new Error('Failed to send notification to Microsoft Teams.\n' + 'Response:\n' + JSON.stringify(safeResponse, null, 2));
Copy link
Owner

@Skitionek Skitionek Oct 23, 2025

Choose a reason for hiding this comment

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

This is fair solution 👍

@morris-kelly
Copy link
Author

I've added this to an action to test it, and there are still issues. The response is now being printed, and showing a status 200.
image

That would suggest that the issue is elsewhere, likely due to this previous commit 39a7b67

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.

Error While using Master Branch Error: Converting circular structure to JSON "circular structure" error message with v1.0.9

2 participants