Skip to content

fix: for Unable to configure Custom Domain for React-Native#1043

Merged
wenxi-zeng merged 7 commits intomasterfrom
proxy-fix
Feb 24, 2025
Merged

fix: for Unable to configure Custom Domain for React-Native#1043
wenxi-zeng merged 7 commits intomasterfrom
proxy-fix

Conversation

@sunitaprajapati89
Copy link
Contributor

fix: for Unable to configure Custom Domain for React-Native

- updated test cases in fetchSettings.test.ts and SegmentDestination.test.ts
- added new test cases in util.test.ts
@wenxi-zeng
Copy link
Contributor

wenxi-zeng commented Feb 18, 2025

unblock e2e tests

the following should unblock the e2e the tests:

  1. update the url in this block to match the changes you made (i.e. /events to v1/b, /settings to /projects/${writekey}/settings).
  2. do the same for this block

NOTE that you need provide the write key to the endpoints

best practice

however, your changes hardcoded the path/endpoints to every domain, which disables the user to fully customize the url to their own endpoints and this is a breaking change. the suggested fix would be:

  1. add a new flag in config, something like useSegmentEndpoints and default it to false. (so we don't break existing customer who use their own path/endpoints`
  2. update your code to append Segment's path/endpoints if and only if useSegmentEndpoints is set to true. otherwise, use the one user provided as is
  3. now you can revert the changes you made on the mock server (mentioned in unblock e2e tests section)
  4. add unit tests to test against useSegmentEndpoints
  5. update readme to reflect this change

Copy link
Contributor

@wenxi-zeng wenxi-zeng left a comment

Choose a reason for hiding this comment

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

LGTM. just address the only comment and update README and it's ready to go

@wenxi-zeng wenxi-zeng merged commit b6b396a into master Feb 24, 2025
7 checks passed
@wenxi-zeng wenxi-zeng deleted the proxy-fix branch February 24, 2025 21:07
@alanjcharles
Copy link
Contributor

🎉 This PR is included in version 2.20.4 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@alanjcharles
Copy link
Contributor

🎉 This PR is included in version 1.3.4 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@alanjcharles
Copy link
Contributor

🎉 This PR is included in version 0.6.1 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@efstathiosntonas
Copy link

efstathiosntonas commented Mar 18, 2025

UNBELIEVABLE!!!

we spent 5 hours to track this down.

The generated endpoint is https://api.segment.io/v1/b/b which returns 404.

We have missed 5 days of events and thousands of dollars loss.

@efstathiosntonas
Copy link

i just can't fucking believe this. How this could have slipped? How such a serious bug went through the tests?

@wenxi-zeng
Copy link
Contributor

@efstathiosntonas really sorry for all the inconvenience it has caused. @sunitaprajapati89 is working on the fix. in the meanwhile, please pass https://api.segment.io/v1/b as the proxy in the config or rollback to the previous version. the unit test only checks if the url ends with the correct endpoints, which makes this issue slipped away. we will update it to catch issues like this.

@wenxi-zeng
Copy link
Contributor

hi @efstathiosntonas the issue should be fixed in 2.20.5. please have a try and let us know if you still experience issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants