I have a heroku pipeline set up, and have just enabled review apps for it. It is using the same codebase as my staging and production apps, same settings files and everything.
When the review app spins up, it can connect to the created DB and run migrations. When I try to connect to the app in the browser, I get
`TypeError: argument 2 must be a connection, cursor or None` in `psycopg2/_json.py, register_json:139`
Top of stack is:
`django.contrib.sites.models._get_site_by_id`.
I've attached the Opbeat output of the error frame at the bottom of this post.
Settings file is linked.
When I set DEBUG=True
, everything works fine. Which might suggest an ALLOWED_HOSTS
issue, but when I set ALLOWED_HOSTS
to '*'
with DEBUG=False
, it still errors?
What is wrong with my setup? This works in staging, and production, but not the review apps.
tldr
I think this might be an error from one of the following:
psycopg2.extensions.register_type
_connect
cpython
static PyObject *psyco_register_type
static PyObject * psyco_connect
examples
Specifcally the error can be raised from :
psycopg2.
in my case:
Apparently this is what it does:
the code in my case which caused the issue was the
create_engine
keywordcreator=get_connection
in the following example:what caused the issue:
And what fixed the issue:
further research indicates the following:
basically
conn_or_curs
is not a connection or cursor, but rather some other thing,