From 4dee26476969382920156949df7e9a2c65a8d212 Mon Sep 17 00:00:00 2001 From: sburman Date: Wed, 22 Nov 2023 00:36:07 +0530 Subject: [PATCH] Update client.js --- docs/use-cases/data-residency-set-hostname.md | 3 ++- packages/client/src/classes/client.js | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/use-cases/data-residency-set-hostname.md b/docs/use-cases/data-residency-set-hostname.md index 5b977d4e..f7ace11b 100644 --- a/docs/use-cases/data-residency-set-hostname.md +++ b/docs/use-cases/data-residency-set-hostname.md @@ -32,6 +32,7 @@ sgMail.send(msg); ## Limitations -1. Emails can only be sent to two hosts for now; 'eu' (https://api.eu.sendgrid.com/) and 'global' (https://api.eu.sendgrid.com/) +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. +2. Emails can only be sent to two hosts for now; 'eu' (https://api.eu.sendgrid.com/) and 'global' (https://api.eu.sendgrid.com/) 2. The default hostname is https://api.sendgrid.com/ 3. The valid values for `region` in `client.setDataResidency(region)` are only `eu` and `global`. Case-sensitive. diff --git a/packages/client/src/classes/client.js b/packages/client/src/classes/client.js index 713dcc31..fb4c4225 100644 --- a/packages/client/src/classes/client.js +++ b/packages/client/src/classes/client.js @@ -43,6 +43,8 @@ class Client { setApiKey(apiKey) { this.auth = 'Bearer ' + apiKey; + console.log('baseUrl: '); + console.log(this.request.baseUrl); this.setDefaultRequest('baseUrl', SENDGRID_BASE_URL); if (!this.isValidApiKey(apiKey)) {