-
-
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
VERCEL_ANALYTICS_ID not found #7573
Comments
There is definitely a history of this being an issue, perhaps there was a regression somewhere! Thanks for reporting. |
Hmm that should be more thoroughly fixed at #6876. How are you deploying your app? If it's handled by Vercel, it should populate the |
I've already sent the deployed example General things: |
Adding the repo: https://github.com/pijusz/molecular-sphere |
Any progress on this one? |
When I run the repro with console.log(process.env.VERCEL_ANALYTICS_ID, process.env.PUBLIC_VERCEL_ANALYTICS_ID)
if (!process.env.VERCEL_ANALYTICS_ID) {
process.env.VERCEL_ANALYTICS_ID = process.env.PUBLIC_VERCEL_ANALYTICS_ID
} |
Vercel Analytics is behind on whole minor version (0.x.x : 0.1.x). Quite possible, that just updating it might work. |
I would expect this to help! We are a bit behind on dependency updates, so we'll try to give this a try |
Try this @Aarekaz
|
I've tried using this but unfortunately it doesn't work. I still get |
Maybe #8021 would help address this, which noted:
The two features could be causing the confusion |
I was having the same problem, |
FWIW, the comment from @bluwy fixed it for me.
My full astro.config.ts:
Package versions: |
I found the problem why on my cases VERCEL_ANALYTICS_ID doesn't get correctly. Current set upI use GitHub Action to build package and publish package to Vercel for deployment using name: Deployment
on:
push:
jobs:
main:
runs-on: ubuntu-latest
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
steps:
- uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v2
- name: Set up nodejs
uses: actions/setup-node@v4
with:
node-version-file: "package.json"
cache: "pnpm"
- name: Pull environment information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build artifacts
run: pnpm build
- name: Deploy artifacts
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} However, this doesn't works because
|
Did this one, but now I have issue
Anyone have some solution? |
@BobidaHombre The @bluwy fix doesn't fix the problem. It just hide the problem.
This code only works if @BobidaHombre You need to check is |
Yup, this is an issue. |
I have the same issue with the direct Astro integration. Using helped to get the vitals on the page loading, but I got the same 400 error, with this message: Then I had a look at the Vercel build and got this warning for Vercel CLI 33.0.1: Then I found this page: Here is written: I suppose the Vercel Speed Insights package has to be updated in Astro. But the Speed Insights package from Vercel also got an update for direct Astro support. I tried it out now, and it works:https://github.com/vercel/speed-insights I used this info to get it working: But it still shows this warning for the Vercel builds: Edit 7 hours later: But every other metric shows up. Edit once more: never mind, just needed more data. The RES now shows up. But vitals in the network tab doesn't. Maybe it doesn't have to, I don't know. |
Thanks for looking into it, @alexkazachkov! Considering that the API we are using is deprecated, we can remove it along with all mentions of Regarding vitals missing, since the new package does not require involvement from the framework, it can be reported directly at |
Hmm, it seems that people are also seeing this issue. I'm using Astro and here's everything I've done:
import { defineConfig } from 'astro/config';
import vercelStatic from '@astrojs/vercel/static';
export default defineConfig({
output: 'static',
adapter: vercelStatic({
webAnalytics: {
enabled: true,
},
speedInsights: {
enabled: true,
},
}),
}); From: https://docs.astro.build/en/guides/integrations-guide/vercel/#speed-insights
"dependencies": {
"@astrojs/vercel": "^6.1.0",
"@vercel/analytics": "^1.1.1",
"@vercel/speed-insights": "^1.0.2",
"astro": "^4.0.7"
}
<script>
import '../nav.js';
import { injectSpeedInsights } from '@vercel/speed-insights';
try {
injectSpeedInsights({});
} catch (error) { // Will remove when Vercel fixes this :/
if (!error.message.includes('VERCEL_ANALYTICS_ID not found')) {
throw error;
}
}
</script> Mostly from: https://vercel.com/docs/speed-insights/quickstart#add-@vercel/speed-insights-to-your-project (Other Frameworks > TS) && vercel/speed-insights#32. Tried to catch the error because I do see Speed Insights on my panel like this: For some reason, I sometimes do see both the Yet with all of that, I get this console error: Now @lilnasy mentioned it's something to do with the deprecation of the old API. Which might be a big factor towards this. Also don't know if I should've posted this somewhere else... please let me know if I should. |
Hello @KingPr0o7, Could you please, if you have time, try out the approach I suggested, to move just the Speed Insights to the native Vercel Astro package? Here are the two links on how to do that: Your dependencies are already up-to-date, so that's good.
And then import this in your head part of your layout:
And then you can message here again, if this removes the error from your page loads. |
@alexkazachkov, with a deeper look into your solution (which admittedly I should've tried beforehand) it does indeed remove the error. Although this solution is a bit hacky, it does get the job done. The only thing (that will probably be fixed later) I noticed with this solution is: Now my question is: Is there a plan to instate a cleaner solution as thus such: ---
import SpeedInsights from '@vercel/speed-insights/astro';
---
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<SpeedInsights />
</head>
</html> |
@KingPr0o7 I actually don't have the error you describe. For me it's not saying that the module can't be found. So I'm not sure where the issue is in your project. My import looks like this:
My dependencies:
So although you have |
@alexkazachkov Hmm that's weird. Removed and reinstalled it, hopefully @lilnasy's pull request will solve this. |
To clarify, my PR does not change anything. It marks the speedInsights config as deprecated. The code paths related to it were the only parts using I'd recommend migrating to the vercel library. |
What version of
astro
are you using?2.7.4
Are you using an SSR adapter? If so, which one?
Vercel/Hybrid
What package manager are you using?
yarn
What operating system are you using?
Windows
What browser are you using?
Chrome
Describe the Bug
config:
built script excerpt:
Once loading any website, there is console error "[Analytics] VERCEL_ANALYTICS_ID not found".
I've tried: different builds (static, hybrid, server)
What's the expected result?
There is no console error, and website reports to Vercel web vitals.
Link to Minimal Reproducible Example
https://molecular-sphere.vercel.app/
Participation
The text was updated successfully, but these errors were encountered: