-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
@astrojs/vercel: Fix vercel analytics id not being provided #6751
Conversation
🦋 Changeset detectedLatest commit: 4987702 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This make sense to me, and thanks for extensively testing it too. Don't think it would be a breaking change either as VERCEL_ANALYTICS_ID
would be set by default as you mentioned.
@bluwy Exactly, thanks for the review 👍 |
@nblackburn Hi, I updated this change, and i can log process.env.VERCEL_ANALYTICS_ID value. |
@tonyski In my efforts to find out why the key wasn't being included, allowed myself to lose track of the fact that only environment variables that are prefixed with At least for me, that environment variable isn't being provided unless I specifically set it myself. |
While testing out vercel analytics using the vercel adapter, I noticed there was an error in my console stating that
VERCEL_ANALYTICS_ID
has not been provided.After some research it looks as though it is looking for
PUBLIC_VERCEL_ANALYTICS_ID
but it is never provided. I believe this is likely the cause of the error.packages/integrations/vercel/src/analytics.ts
Running
vc pull
with the analytics enabled downloads an environment locally which containsVERCEL_ANALYTICS_ID
and notPUBLIC_VERCEL_ANALYTICS_ID
. The documentation also mentions that the environment variable is inlined at build time.https://vercel.com/docs/concepts/analytics/api#getting-started
Changes
Testing
Before fix: https://welcome-to-astro-7lrfynd8t-nblackburn.vercel.app/
After fix: https://welcome-to-astro-irzdnom89-nblackburn.vercel.app/
Docs
With this being, an internal change, I don't believe it requires any changes to the documentation.
/cc @withastro/maintainers-docs for feedback!