feat: Add data residency for eu and global regions by shrutiburman · Pull Request #1390 · sendgrid/sendgrid-nodejs
Fixes DII-1230
This PR:
- Adds a setter
setDataResidency()which allows the users to switch to EU sub region, reidrecting their requests toapi.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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
k725
mentioned this pull request
8 tasks
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CR
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.
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
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?
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?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CR
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]);
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
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters