Cryptic "Internal Error"

I have this code :

try:
    r = anvil.http.request(url, json=False, headers=headers, method=method, data=payload)
except anvil.http.HttpError as e:

that generates this error (not picked up by the try block even if I expand the except scope) :
anvil.server.InternalError: Internal server error: 49ecc114f028

The error line in the traceback is that request. I can’t give you a clone link at the moment; until I can, does that error code point to anything your side?

Interestingly, the error is the same whether or not I have import anvil.http in the module or not.

Hi David, any difference if you put a pass after the exception?

Nah - but I found the issue.

I pass a string for the “method” parameter with “POST” in it. When I replace that with a hard coded method="POST" it works.

Checking to see what I’m doing wrong with the variable I’m setting.

EDIT - it is, of course, my fault. I was passing the wrong value in a positional parameter to a function, so i was setting “method” to a long, url encoded parameter list.

In my defence, it should have been a better error message than that, though. :crazy_face:

2 Likes

Just fyi, that snippet was shamefully incomplete, there were print statements in the except block. I knew the issue was to do with that request line, but I just couldn’t see the wood for the trees and I hoped the cryptic error message might mean something to Anvil Central. As is typical with me, I usually find the issue as soon as I post…

1 Like