Tips to debug staging or production environment


I published an application to its staging environment and realised some functionalities were broken. However, these same functionalities are working correctly when running my development environment (with the same inputs). It is therefore a bit hard to find what is going wrong and debug it without a CLI. Any tips about how to tackle this kind of issue?

1 Like

Are you sure you are working on the same version? If your staging environment is on tag v1.0.0, are you sure your development environment is not accidentally on a new version of your app? You can check out tags as well as commits, so to ensure you don’t have a mismatch, check which tag your staging environment is on, and then check out that same tag in your development repo using git checkout vX.X.X

Oh and another remark: something else that might cause different behaviour is the fact that deployed apps have 500 MB of RAM, but your development environment obviously has much more (whatever your laptop has). You can however simulate this limitation by using viktor-cli start APPNAME --max-memory MEMORY_IN_MB (see this section of the docs)

Oef this was a nasty one! It turned out that default HiddenFields are not automatically generated when an entity is created in production environments. One must first save the entity to make the HiddenField appear in the database. Props to @khameeteman!
Thanks Roeland for your hindsight, this was not applicable here but could still be useful for other use-cases!

Since we don’t have access to a logger for apps in production, it’s a bit tricky to find the origin of such bugs. What helped me was using extra try and except into the code and raise UserException when publishing. Not so elegant and time consuming, but still acts as a substitute to print statements.