How to get logs when developing through Python /api/ Serverless Functions?
Unanswered
Horned Puffin posted this in #help-forum
Horned PuffinOP
I'm building a NextJS/FastAPI application from one of the templates provided by FastAPI and I've been able to deploy my application, but I haven't been able to get any logs out
Whether it's explicit logs like using print / logger, or getting GET/POST request info logs, there is nothing in my project dashboard logs
This is making debugging impossible at the moment
Whether it's explicit logs like using print / logger, or getting GET/POST request info logs, there is nothing in my project dashboard logs
This is making debugging impossible at the moment
29 Replies
Horned PuffinOP
@Jboncz thx!
Your using vercel I take it?
Horned PuffinOP
Yessir
and can you link what template your using?
Horned PuffinOP
Try to deploy it then use a print in the index.py, you won't get anything
Nor any info logs when someone hits the endpoint
It's just a black hole
Can you show me one of your endpoints?
If your logging it should be under runtime logs
Horned PuffinOP
I think I've tried that but let me try it again
Yeah so they are just blank
Whether I use Live or not
Are you using console.log anywhere in your endpoint?
Horned PuffinOP
Console log works fine because that's the frontend code
I use print because Python is what I'm using in the backend
I use print because Python is what I'm using in the backend
Right, how are you calling the python script?
Horned PuffinOP
So if you check that template, they make calls through the frontend https://github.com/digitros/nextjs-fastapi
You can also navigate to api/index
im not super familiar with fastapi, but based on this you arent going to be able to see the logs because its not within the nextjs environment
Horned PuffinOP
To do a GET
Got it

Your literally rerouting outside of nextjs
Horned PuffinOP
Feels like this Python Serverless feature is an afterthought for Vercel
I regret developing on it
Ive never used it lol
Horned PuffinOP
I'll just host a backend outside Vercel
I self host, so I do call python and other scripts, but I call them at the OS level, and feed the output back into nextjs