This is a project to reproduce a log error with Pino and Axiom. When running the project in development mode, everything works fine, but when running the project in production mode, the log is not displayed. Looking at the log generated by Netlify, I see the following error:
ERROR Error: unable to determine transport target for "@axiomhq/pino"
Clone the project, when done, run the following command:
# create a new project in the current directory
npm install
Change .env.example to .env and fill in the Axiom values
# create a new project in my-app
npm run dev
If everything is working, you will see the logging on axiom.co dashboard. The logging is generated in +page.server.ts
If you deploy this project to Netlify or Vercel and you open the website, you'll get error 500. You can see the log on Netlify with the following output:
Aug 4, 06:00:52 PM: be65b265 ERROR Error: unable to determine transport target for "@axiomhq/pino"
at fixTarget (file:///var/task/.netlify/functions-internal/sveltekit-render.mjs:3892:17)
at Function.transport (file:///var/task/.netlify/functions-internal/sveltekit-render.mjs:3872:26)
at createLogger (file:///var/task/.netlify/functions-internal/sveltekit-render.mjs:5618:25)
at .netlify/server/entries/pages/_page.server.ts.js (file:///var/task/.netlify/functions-internal/sveltekit-render.mjs:5636:14)
at __init (file:///var/task/.netlify/functions-internal/sveltekit-render.mjs:23:56)
at .netlify/server/nodes/2.js (file:///var/task/.netlify/functions-internal/sveltekit-render.mjs:5675:5)
at __init (file:///var/task/.netlify/functions-internal/sveltekit-render.mjs:23:56)
at file:///var/task/.netlify/functions-internal/sveltekit-render.mjs:9156:52
at async Promise.all (index 1)
at async render_page (file:///var/task/.netlify/functions-internal/sveltekit-render.mjs:7919:19)
I hope I provided enough information to reproduce the problem and help you fix it. Thank you for your time.