Skip to content
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

feat: Add data residency for eu and global regions #1390

Merged
merged 10 commits into from
Dec 6, 2023

Conversation

shrutiburman
Copy link
Contributor

Fixes DII-1230

This PR:

  • Adds a setter setDataResidency() which allows the users to switch to EU sub region, reidrecting their requests to api.eu.sendgrid.com
  • Upgrades the testing pipeline to node v10+ (eslint and typescript do not work well on <10 versions)
  • Upgrades typescript, which was causing the pipleine failure for very long

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 read the Contribution Guidelines and my PR follows them
  • 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 added the necessary documentation about the functionality in the appropriate .md file
  • I have added inline documentation to the code I modified

If you have questions, please file a support ticket.

Copy link
Contributor

@manisha1997 manisha1997 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

@gladysmae08 gladysmae08 left a comment

Choose a reason for hiding this comment

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

CR

packages/client/src/client.spec.js Show resolved Hide resolved
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!


## Limitations

1. Setting the API Key (via `client.setApiKey()`) or Twilio Authentication (via `client.setTwilioEmailAuth()`) will override the hostname to default value. Use the setter call after this set-up.

Choose a reason for hiding this comment

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

is this something we should figure out a better path for? This is not an ideal scenario.

Copy link

Choose a reason for hiding this comment

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

@tbischel @gladysmae08
Hi, I hope my PR offers a solution to this issue. Please take a look and I would appreciate any feedback.

Choose a reason for hiding this comment

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

I think this limitation is no longer necessary after the changes that were just added

Copy link

Choose a reason for hiding this comment

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

this won't introduce breaking changes for existing customers, right?

Copy link

Choose a reason for hiding this comment

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

if customers don't have to change their code to achieve the same functionality, I think I'm good. if they do, we might want to look into a major version bump?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This wont introduce a breaking change, as the region attribute that's newly introduced has a default value, and will only get updated if the setter for data residency is called.

Copy link

@tbischel tbischel left a comment

Choose a reason for hiding this comment

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

I think we need to resolve this usability gap on the setApiKey and setDataResidency before we release.

Copy link

@gladysmae08 gladysmae08 left a comment

Choose a reason for hiding this comment

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

CR

packages/client/src/classes/client.js Outdated Show resolved Hide resolved
Comment on lines 47 to 50
// this means that region was never set before
if (this.sendgrid_region == '') {
this.setDefaultRequest('baseUrl', SENDGRID_BASE_URL);
}

Choose a reason for hiding this comment

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

This technically works but I think it is unnecessary. We can just always reset the baseUrl here based on the saved region

this.setDefaultRequest('baseUrl', REGION_HOST_MAP[this.sendgrid_region]);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, I have set the default region as 'global', we can reset based on that now. Thanks.


## Limitations

1. Setting the API Key (via `client.setApiKey()`) or Twilio Authentication (via `client.setTwilioEmailAuth()`) will override the hostname to default value. Use the setter call after this set-up.

Choose a reason for hiding this comment

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

I think this limitation is no longer necessary after the changes that were just added

@mvanzoest
Copy link

Hi, would it be possible to open a separate PR for the version upgrades? A number of people are awaiting #1387 in order to complete their security upgrades.

@shrutiburman
Copy link
Contributor Author

I think we need to resolve this usability gap on the setApiKey and setDataResidency before we release.

We have resolved the discrepancy in the latest commits. The limitation no longer exists.

Copy link

@gladysmae08 gladysmae08 left a comment

Choose a reason for hiding this comment

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

LGTM

@shrutiburman shrutiburman merged commit eed8ba2 into main Dec 6, 2023
13 checks passed
@shrutiburman shrutiburman deleted the add-region-setter branch December 6, 2023 05:07
This was referenced Sep 13, 2024
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.

7 participants