heroku internal server error

178 views
Skip to first unread message

Duygu Yalinkilinc (Alumni)

unread,
Apr 20, 2021, 7:04:05 AM4/20/21
to oTree help & discussion
Hello all,

I have deployed my experiment to heroku and although my experiment works fine when I run it on my local device using devserver command, as I start a session in heroku all I get is a blank page displaying "Internal Server Error". You may see the logs below. 

Could anybody guide me on how to solve this? 

Thanks in advance,
Best. 

2021-04-20T10:37:51.381442+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/persistence.py", line 994, in _emit_update_statements

2021-04-20T10:37:51.381442+00:00 app[web.1]: c = cached_connections[connection].execute(

2021-04-20T10:37:51.381443+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1011, in execute

2021-04-20T10:37:51.381443+00:00 app[web.1]: return meth(self, multiparams, params)

2021-04-20T10:37:51.381444+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/sql/elements.py", line 298, in _execute_on_connection

2021-04-20T10:37:51.381444+00:00 app[web.1]: return connection._execute_clauseelement(self, multiparams, params)

2021-04-20T10:37:51.381444+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1124, in _execute_clauseelement

2021-04-20T10:37:51.381445+00:00 app[web.1]: ret = self._execute_context(

2021-04-20T10:37:51.381445+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1316, in _execute_context

2021-04-20T10:37:51.381446+00:00 app[web.1]: self._handle_dbapi_exception(

2021-04-20T10:37:51.381446+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1510, in _handle_dbapi_exception

2021-04-20T10:37:51.381447+00:00 app[web.1]: util.raise_(

2021-04-20T10:37:51.381447+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 182, in raise_

2021-04-20T10:37:51.381447+00:00 app[web.1]: raise exception

2021-04-20T10:37:51.381448+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context

2021-04-20T10:37:51.381448+00:00 app[web.1]: self.dialect.do_execute(

2021-04-20T10:37:51.381449+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 609, in do_execute

2021-04-20T10:37:51.381449+00:00 app[web.1]: cursor.execute(statement, parameters)

2021-04-20T10:37:51.381450+00:00 app[web.1]: sqlalchemy.exc.DataError: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely)

2021-04-20T10:37:51.381450+00:00 app[web.1]: (psycopg2.errors.NumericValueOutOfRange) integer out of range

2021-04-20T10:37:51.381450+00:00 app[web.1]: 

2021-04-20T10:37:51.381451+00:00 app[web.1]: [SQL: UPDATE race_group SET start_time=%(start_time)s, last_move_time=%(last_move_time)s WHERE race_group.id = %(race_group_id)s]

2021-04-20T10:37:51.381452+00:00 app[web.1]: [parameters: {'start_time': 1618915071366, 'last_move_time': 1618915071366, 'race_group_id': 1}]

2021-04-20T10:37:51.381452+00:00 app[web.1]: (Background on this error at: http://sqlalche.me/e/13/9h9h)

2021-04-20T10:37:51.381452+00:00 app[web.1]: 

2021-04-20T10:37:51.381453+00:00 app[web.1]: During handling of the above exception, another exception occurred:

2021-04-20T10:37:51.381453+00:00 app[web.1]: 

2021-04-20T10:37:51.381454+00:00 app[web.1]: Traceback (most recent call last):

2021-04-20T10:37:51.381454+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/uvicorn/protocols/http/h11_impl.py", line 394, in run_asgi

2021-04-20T10:37:51.381454+00:00 app[web.1]: result = await app(self.scope, self.receive, self.send)

2021-04-20T10:37:51.381455+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__

2021-04-20T10:37:51.381455+00:00 app[web.1]: return await self.app(scope, receive, send)

2021-04-20T10:37:51.381456+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/starlette/applications.py", line 112, in __call__

2021-04-20T10:37:51.381456+00:00 app[web.1]: await self.middleware_stack(scope, receive, send)

2021-04-20T10:37:51.381456+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/starlette/middleware/base.py", line 25, in __call__

2021-04-20T10:37:51.381457+00:00 app[web.1]: response = await self.dispatch_func(request, self.call_next)

2021-04-20T10:37:51.381457+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/otree/middleware.py", line 23, in dispatch

2021-04-20T10:37:51.381457+00:00 app[web.1]: response = await call_next(request)

2021-04-20T10:37:51.381458+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/starlette/middleware/base.py", line 45, in call_next

2021-04-20T10:37:51.381458+00:00 app[web.1]: task.result()

2021-04-20T10:37:51.381463+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/starlette/middleware/base.py", line 38, in coro

2021-04-20T10:37:51.381463+00:00 app[web.1]: await self.app(scope, receive, send)

2021-04-20T10:37:51.381464+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/otree/errorpage.py", line 230, in __call__

2021-04-20T10:37:51.381464+00:00 app[web.1]: response = self.debug_response(request, exc)

2021-04-20T10:37:51.381465+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/starlette/middleware/errors.py", line 245, in debug_response

2021-04-20T10:37:51.381465+00:00 app[web.1]: content = self.generate_html(exc)

2021-04-20T10:37:51.381465+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/otree/errorpage.py", line 135, in generate_html

2021-04-20T10:37:51.381466+00:00 app[web.1]: traceback_obj = traceback.TracebackException.from_exception(

2021-04-20T10:37:51.381466+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/traceback.py", line 529, in from_exception

2021-04-20T10:37:51.381467+00:00 app[web.1]: return cls(type(exc), exc, exc.__traceback__, *args, **kwargs)

2021-04-20T10:37:51.381467+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/traceback.py", line 508, in __init__

2021-04-20T10:37:51.381467+00:00 app[web.1]: self.stack = StackSummary.extract(

2021-04-20T10:37:51.381468+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/traceback.py", line 359, in extract

2021-04-20T10:37:51.381468+00:00 app[web.1]: result.append(FrameSummary(

2021-04-20T10:37:51.381469+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/traceback.py", line 260, in __init__

2021-04-20T10:37:51.381469+00:00 app[web.1]: self.locals = {k: repr(v) for k, v in locals.items()} if locals else None

2021-04-20T10:37:51.381470+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/traceback.py", line 260, in <dictcomp>

2021-04-20T10:37:51.381470+00:00 app[web.1]: self.locals = {k: repr(v) for k, v in locals.items()} if locals else None

2021-04-20T10:37:51.381470+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/otree/database.py", line 320, in __repr__

2021-04-20T10:37:51.381471+00:00 app[web.1]: return '<{} id={}>'.format(self.__class__.__name__, self.id)

2021-04-20T10:37:51.381471+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/attributes.py", line 294, in __get__

2021-04-20T10:37:51.381472+00:00 app[web.1]: return self.impl.get(instance_state(instance), dict_)

2021-04-20T10:37:51.381472+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/attributes.py", line 725, in get

2021-04-20T10:37:51.381472+00:00 app[web.1]: value = state._load_expired(state, passive)

2021-04-20T10:37:51.381473+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/state.py", line 652, in _load_expired

2021-04-20T10:37:51.381473+00:00 app[web.1]: self.manager.deferred_scalar_loader(self, toload)

2021-04-20T10:37:51.381474+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/loading.py", line 1006, in load_scalar_attributes

2021-04-20T10:37:51.381474+00:00 app[web.1]: result = load_on_ident(

2021-04-20T10:37:51.381475+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/loading.py", line 200, in load_on_ident

2021-04-20T10:37:51.381475+00:00 app[web.1]: return load_on_pk_identity(

2021-04-20T10:37:51.381481+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/loading.py", line 286, in load_on_pk_identity

2021-04-20T10:37:51.381481+00:00 app[web.1]: return q.one()

2021-04-20T10:37:51.381482+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 3490, in one

2021-04-20T10:37:51.381482+00:00 app[web.1]: ret = self.one_or_none()

2021-04-20T10:37:51.381483+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 3459, in one_or_none

2021-04-20T10:37:51.381483+00:00 app[web.1]: ret = list(self)

2021-04-20T10:37:51.381483+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 3535, in __iter__

2021-04-20T10:37:51.381484+00:00 app[web.1]: return self._execute_and_instances(context)

2021-04-20T10:37:51.381484+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 3556, in _execute_and_instances

2021-04-20T10:37:51.381484+00:00 app[web.1]: conn = self._get_bind_args(

2021-04-20T10:37:51.381485+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 3571, in _get_bind_args

2021-04-20T10:37:51.381485+00:00 app[web.1]: return fn(

2021-04-20T10:37:51.381486+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 3550, in _connection_from_session

2021-04-20T10:37:51.381486+00:00 app[web.1]: conn = self.session.connection(**kw)

2021-04-20T10:37:51.381487+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1142, in connection

2021-04-20T10:37:51.381487+00:00 app[web.1]: return self._connection_for_bind(

2021-04-20T10:37:51.381488+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1150, in _connection_for_bind

2021-04-20T10:37:51.381488+00:00 app[web.1]: return self.transaction._connection_for_bind(

2021-04-20T10:37:51.381489+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 409, in _connection_for_bind

2021-04-20T10:37:51.381489+00:00 app[web.1]: self._assert_active()

2021-04-20T10:37:51.381489+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 289, in _assert_active

2021-04-20T10:37:51.381490+00:00 app[web.1]: raise sa_exc.InvalidRequestError(

2021-04-20T10:37:51.381495+00:00 app[web.1]: sqlalchemy.exc.InvalidRequestError: This Session's transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely)

2021-04-20T10:37:51.381495+00:00 app[web.1]: (psycopg2.errors.NumericValueOutOfRange) integer out of range

2021-04-20T10:37:51.381496+00:00 app[web.1]: 

2021-04-20T10:37:51.381496+00:00 app[web.1]: [SQL: UPDATE race_group SET start_time=%(start_time)s, last_move_time=%(last_move_time)s WHERE race_group.id = %(race_group_id)s]

2021-04-20T10:37:51.381497+00:00 app[web.1]: [parameters: {'start_time': 1618915071366, 'last_move_time': 1618915071366, 'race_group_id': 1}]

2021-04-20T10:37:51.381497+00:00 app[web.1]: (Background on this error at: http://sqlalche.me/e/13/9h9h) (Background on this error at: http://sqlalche.me/e/13/7s2a)

2021-04-20T10:37:51.381606+00:00 app[web.1]: INFO:     188.119.40.104:0 - "GET /p/071qju9b/race/MyPage/1 HTTP/1.1" 500 Internal Server Error

2021-04-20T10:37:51.382445+00:00 heroku[router]: at=info method=GET path="/p/071qju9b/race/MyPage/1" host=racegamenew.herokuapp.com request_id=600a66bf-b0b5-45ca-a2d0-add631b34c6e fwd="188.119.40.104" dyno=web.1 connect=0ms service=29ms status=500 bytes=212 protocol=https

Chris @ oTree

unread,
Apr 20, 2021, 11:21:27 AM4/20/21
to Duygu Yalinkilinc (Alumni), oTree help & discussion
It looks like you’re using an IntegerField to store javascript timestamps. Javascript timestamps are very large integers, bigger than the range of the Postgres INTEGER field. That’s why you get this number out of range error. Ways to fix it include storing the timestamp in a more compact form, or saving it to a string instead of integer. 

Sent from my phone

On Apr 20, 2021, at 7:04 PM, Duygu Yalinkilinc (Alumni) <dyalin...@alumni.sabanciuniv.edu> wrote:

Hello all,
--
You received this message because you are subscribed to the Google Groups "oTree help & discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to otree+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/otree/5ff1d036-9f98-4a7c-9298-94e2c13c1ffcn%40googlegroups.com.

Duygu Yalinkilinc (Alumni)

unread,
Apr 21, 2021, 1:54:08 AM4/21/21
to Chris @ oTree, oTree help & discussion
Thank you Chris, saving in a string worked.

Best,
Reply all
Reply to author
Forward
0 new messages