axiomhq/next-axiom

Sending Client Logs on Non-enterprise netlify account

isaac-martin opened this issue · 1 comments

Hey - I have followed the setup instructions but any logs sent clientside are not flowing through to axiom.
This is locally, and also on non-enterprise netlify.

  • I can verify the rewrites are being added to my next config (and when going to the rewrites url /_axiom/logs i get a not-found api response rather than my 404 page which i guess is from sending a GET request to an API that is expecting POST
  • These log error messages are not running https://github.com/axiomhq/next-axiom/blob/main/src/withAxiom.ts#L31, which leads me to believe that all variables are correctly there
  • My AXIOM_TOKEN and AXIOM_DATASET are both set and validated they are there
  • Logs in api routes work
  • There are no network calls to the /_axiom/logs endpoint from my frontend
image

Any ideas? Seems like theres a few others having this problem but it looks like in v 0.17 it was stable in non vercel platforms?

To do this client side you need to expose your env variables. Can do via adding them to the env property in next.config
https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables

env: {
        AXIOM_TOKEN: process.env.AXIOM_TOKEN,
        AXIOM_DATASET: process.env.AXIOM_DATASET,
      },