anvil.server.InternalError: Internal server error: 96a6c05bd59a
at /downlink/anvil/_threaded_server.py, line 404
called from /downlink/anvil/server.py, line 40
called from /downlink/anvil/users/__init__.py, line 45
called from ContractsModule, line 61
line 61 is creating a dict entry 'modified_by' : anvil.users.get_user(),
Just received the following error on the same get user code.
InternalError: Internal server error: e4b331992dcd
at /downlink/anvil/_threaded_server.py, line 404
called from /downlink/anvil/server.py, line 40
called from /downlink/anvil/users/__init__.py, line 45
called from ContractsModule, line 119
called from /downlink/anvil/tables/__init__.py, line 75
called from Supplier.SupplierMain.Contracts.RowTemplate1, line 73
Sorry for the unhelpful error message. Thatās showing up as a transaction conflict in our internal logs - are you able to share more context of what youāre trying to do?
Thanks @brooke. That makes some sense. The server function is accessing a number of tables but the error keeps occuring on the get_user() line.
It is my first attempt at applying the @anvil.tables.in_transaction so I my be applying this incorrectly. I have followed this section of the docs.
Can you please provide best practice for applying the decorator to a server function that relies on other callable server functions also accessing the tables and how to call them (anvil.server.call('foo.bar') or from .foo import bar). At this stage I have only applied the decorator to this function.
You canāt nest transactions inside each other, but if you are only using @anvil.tables.in_transaction once, then thatās probably not the problem.
Are you able to provide a minimal clone link that demonstrates the error? Are you always getting this error or only when there are multiple concurrent sessions?
You can use anvil.server.call(āfoo.barā) or from .foo import bar, they both should work fine, but the latter option will have less performance overhead.
Thanks @brooke. Unfortunately I found a work around and would have to roll some code back to get it. I will keep an eye out to see if it repeats but nothing so far.
If foo.bar() is also wrapped in the @anvil.server.callable and @anvil.tables.in_transaction decorators and is called from within another function with the same decorators, does this create a conflict error?
Iām glad you havenāt seen the error again! But do let us know if it returns.
Nested transactions arenāt supported, so itās best to make function calls to undecorated functions from within an @anvil.tables.in_transaction decorated server function.
Iām getting the error āInternal server error: fbf05bba3cccā while trying to do a stripe checkout. Can you please help?
from ._anvil_designer import Form1Template
from anvil import *
import anvil.server
import stripe.checkout
class Form1(Form1Template):
def init(self, **properties):
# Set Form properties and Data Bindings.
try:
c = stripe.checkout.charge(currency=āINRā, amount=100)
print(c)
except Exception as e:
alert(str(e))
return