Dear instructor,
I am working on a MAC machine and after writing all the code till lecture number 22. I am getting connection to the db Failed error.
Please refer the GitHub Repo and screenshot given for the clarification.
Hi Kapil,
The error says that the "role does not exist" which means the POSTGRES_USER specified in core > config.py file is None.
There could be several reasons for this.
1. POSTGRES_USER might not be specified in your .env file.
2. There could be a spelling mistake for POSTGRES_USER in the .env file or config.py file.
3. There could be a spelling mistake in the DATABASE_URL line.
My suggestion would be to try to print the values of POSTGRES_USER and DATABASE_URL and manually check if the role is being displayed.
I am attaching a screenshot below for the process.
My priority is to help build a production-ready application using FastAPI
I prioritize quality over simplicity. Our challenging approach ensures you're prepared for real-world development.
© Copyright 2022-2025 Team FastAPITutorial. All rights reserved.