Skip to content

[WIP] Fix TypeError: Client is not a constructor#42

Merged
Subterrane merged 2 commits into
developfrom
copilot/fix-client-constructor-error
Nov 21, 2025
Merged

[WIP] Fix TypeError: Client is not a constructor#42
Subterrane merged 2 commits into
developfrom
copilot/fix-client-constructor-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 21, 2025

Fix TypeError: Client is not a constructor ✅

Issue Resolved: Users were encountering "TypeError: Client is not a constructor" when trying to use the SDK.

Root Cause: The SDK only exported DefaultApi but not a Client class, which is a common naming convention users expect.

Solution Implemented:

  • Investigate the issue - confirmed Client export was missing
  • Add Client export as alias to DefaultApi in api/apis.ts
  • Rebuild and verify both Client and DefaultApi work correctly
  • Update README.md with Client usage example showing both options
  • Test comprehensive functionality (JS and TS)
  • Run code review - no issues found
  • Run security checks (CodeQL) - no vulnerabilities found
  • Final verification - all tests pass

Changes Made:

  1. Added export { DefaultApi as Client } in api/apis.ts
  2. Updated README.md with example showing both Client and DefaultApi usage

Backward Compatibility:
✅ Fully backward compatible - existing code using DefaultApi continues to work
Client and DefaultApi are identical (same class, just different export names)

Testing:
✅ JavaScript tests: Both constructors work correctly
✅ TypeScript tests: Type definitions are correct
✅ Integration tests: All API methods available on both
✅ Code review: No issues
✅ Security scan: No vulnerabilities

Security Summary:
No security vulnerabilities discovered or introduced by these changes. CodeQL analysis found 0 alerts.

Original prompt

This section details on the original issue you should resolve

<issue_title>TypeError: Client is not a constructor</issue_title>
<issue_description>Hi,

When running your code examples it always returns TypeError: Client is not a constructor

image
</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Add Client export as an alias to DefaultApi to fix "TypeError: Client is not a constructor" error. Users can now use either OneLoginApi.Client or OneLoginApi.DefaultApi interchangeably. Updated README with example showing both options.

Co-authored-by: Subterrane <5290140+Subterrane@users.noreply.github.com>
@Subterrane Subterrane marked this pull request as ready for review November 21, 2025 23:55
@Subterrane Subterrane merged commit c94b0d8 into develop Nov 21, 2025
8 checks passed
@Subterrane Subterrane deleted the copilot/fix-client-constructor-error branch November 21, 2025 23:55
Copilot AI requested a review from Subterrane November 21, 2025 23:56
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.

TypeError: Client is not a constructor

2 participants