fix: Conditionally check for PENDO_API_KEY
before Pendo set up
#11089
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description 📝
We use an environment variable
PENDO_API_KEY
to load the Pendo agent. Without that API key present, we should not do any set up or loading of Pendo. (We handle Adobe Analytics in the same way -my mistake for missing it here.)Changes 🔄
PENDO_API_KEY
in the usePendo hook to confirm the env var exists before attempting to load the pendo object on the window or make a request to the CDN for the Pendo agentTarget release date 🗓️
10/14/24 - this is pointed at the release branch because it needs to be included in the release.
Preview 📷
How to test 🧪
Prerequisites
(How to setup test environment)
PENDO_API_KEY
from your.env
file.Reproduction steps
(How to reproduce the issue, if applicable)
develop
branch locally and, with thePENDO_API_KEY
commented out in your .env, go to http://localhost:3000. Observe the browser console error above. In the Network tab, filter on "All" requests and keyword "pendo". Observe that a request was made to get the Pendo CDN, but it returned a 403 Unauthorized without the API key.Verification steps
(How to verify changes)
PENDO_API_KEY
commented out in your .env, go to http://localhost:3000.PENDO_API_KEY
. Observe Pendo loads from the CDN as expected.As an Author I have considered 🤔
Check all that apply