Skip to content

Conversation

@deshartman
Copy link
Contributor

Summary

Add edge parameter support to profile configuration for regional Twilio endpoints. Regional endpoints require both region and edge location (e.g., api.sydney.au1.twilio.com).

Changes:

  • Add edge parameter to ConfigDataProfile class for per-profile storage
  • Add TWILIO_EDGE environment variable support to getProfileFromEnvironment()
  • Update addProfile() with backward compatibility for existing 5-parameter calls
  • Update buildClient() to prioritize edge resolution: process.env.TWILIO_EDGE > profile.edge > userConfig.edge
  • Add REGION_AUTH_TOKEN_REQUIRED error message for regional auth failures
  • Enhance CliRequestClient.formatErrorMessage() to add hints for error code 20003 when accessing regional resources
  • Add comprehensive test coverage including backward compatibility tests

Test plan

  • All existing tests pass (192 tests)
  • New tests added for edge parameter functionality
  • Backward compatibility verified with 5-parameter addProfile calls
  • Tested with real AU1 account - successful profile creation and API calls

Checklist

  • I acknowledge that all my contributions will be made under the project's license
  • I have made a material change to the repo (functionality, testing, spelling, grammar)
  • I have titled the PR appropriately
  • I have updated my branch with the main branch
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated CHANGES.md with the functionality details

🤖 Generated with Claude Code

deshartman and others added 2 commits December 2, 2025 17:24
Add edge parameter to profile configuration to support regional
Twilio endpoints. Regional endpoints require both region and edge
location (e.g., api.sydney.au1.twilio.com).

Changes:
- Add edge parameter to ConfigDataProfile class
- Add TWILIO_EDGE environment variable support
- Update addProfile() with backward compatibility for 5-param calls
- Update buildClient() to prioritize edge: env > profile > config
- Add regional authentication error guidance for 20003 errors
- Add comprehensive test coverage for edge functionality

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Resolved conflict in buildClient() by integrating profile.edge support
with new REGION_EDGE_MAP and deprecation warning logic from main.

Updated edge resolution to: env > profile.edge > config.edge, while
preserving the new automatic edge mapping for regions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@deshartman
Copy link
Contributor Author

SonarCloud Scan Failure - Fork PR Limitation

The test jobs are showing as failed, but all 197 tests are actually passing

The failure is only due to the SonarCloud scan, which shows:

ERROR Project not found. Please check the 'sonar.projectKey' and 'sonar.organization' properties, 
the 'SONAR_TOKEN' environment variable

Root Cause

This is a GitHub security limitation with fork-based PRs:

  • This PR is from deshartman/twilio-cli-core (fork) → twilio/twilio-cli-core (main repo)
  • GitHub does not pass repository secrets (like SONAR_TOKEN) to workflows triggered by fork PRs
  • SonarCloud cannot authenticate without the token, causing the scan to fail

Verification

  • ✅ All unit tests pass (197 passing)
  • ✅ All linting checks pass
  • ✅ All npm audit checks pass
  • ❌ SonarCloud scan fails (expected for fork PRs)

Resolution Options

  1. Re-run the workflow with secrets enabled (requires maintainer approval)
  2. Skip SonarCloud check for this fork-based PR
  3. Push branch directly to twilio/twilio-cli-core to give workflows access to secrets

The code changes are working correctly and all functional tests pass.

The changelog is auto-populated by the automated workflow, so removing manual entries as requested by reviewer.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@deshartman
Copy link
Contributor Author

tiwarishubham635 as mentioned, I do not have access to the SonarCloud components, so cannot pass these. Let me know next steps. As mentioned this is related to twilio/twilio-cli#669 and https://github.com/twilio-internal/docs/pull/5655, which I have updated

Copy link
Contributor

@tiwarishubham635 tiwarishubham635 left a comment

Choose a reason for hiding this comment

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

LGTM!

@tiwarishubham635 tiwarishubham635 merged commit 9f023f4 into twilio:main Dec 5, 2025
6 of 9 checks passed
@deshartman
Copy link
Contributor Author

Thank you so much

twilio-dx pushed a commit that referenced this pull request Dec 8, 2025
### [8.2.4](8.2.3...8.2.4) (2025-12-08)

### Library - Fixes

* Add edge parameter support for regional authentication ([#298](#298)) ([9f023f4](9f023f4))
* Regional Endpoint Processing ([#296](#296)) ([b3786ca](b3786ca)), closes [#297](#297)

### Library - Chores

* add npm token for semantic-release authentication ([e13b03c](e13b03c))
* Add trusted publisher ([#299](#299)) ([a544aea](a544aea))
* remove registry url ([6a1c488](6a1c488))
@deshartman deshartman deleted the fix/regional-auth-tokens branch December 8, 2025 22:39
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.

3 participants