I have a canister that serves generated text via the http_request method. When I try to get a response, I get the following:
Replica Error (5): "IC0503: Canister rrkah-fqaaa-aaaaa-aaaaq-cai trapped explicitly: Array index out of bounds"
Nothing prints out in the console where I started dfx, nor in the developer tools console (except for a 500 (Internal Server Error
with no other information).
But I have no idea where in my code the offending array is. How can I find out? It seems that when a canister traps, no stack trace is printed anywhere. Iβve debugged traps before by peppering my motoko code with Debug.print(β1β) and Debug.print(β2β), etc, but surely this canβt be the recommended method of getting to the bottom of an error like this.
Any suggestions?