Internal Error Debugging
thanks for reply, In my deployed worker It shows many internal errors and also when I debug it locally, when I do put code blocks into
try{}catch{}
also it doesn't work and the internal errors are not caught and have not informative message to fix the bug, It only shows Internal error message nothing else.23 Replies
@Ashkan do you have an example repo somewhere, or something I can test with to see what errors you are getting?
I am working for a company that I am not eligible to share the code. However, I can share any information in my dashboard if it helps
Do you have specific code blocks that are throwing the errors? I'm trying to narrow what you are doing that could be causing the issue

Does this happen with a default Worker on the account?

yup
I have a a single worker
To confirm, by default Worker, I mean if you go through the "create a worker" steps on the dashboard, and don't touch anything else, it still shows an internal error?
no it's a complex script that I push it via wrangler to my dashboard
So, does a Default Worker work? I'm trying to figure out if it is something failing at the account level, or if it is something happening in your code causing it to fail
I made my worker via wrangler CLI and made the worker and wrangler login -> wrangler deploy --minify
Yes, but if you go and create a new Worker, with just the basics, does it work?
actually I haven't tried it yet, should I try that? I mean bypass wrangler and go directly to dashboard worker creation?!
Yeah. Don't deploy your large Worker yet. Just see if a standard "Hello World" Worker works first
I have 3-4 script in my dashboard and they are working as expected just this worker that is most complex one
Huh ok, so it isn't an issue with the account. I do wonder though, the Worker might be complex enough that it is failing to boot in a reasonable amount of time. Do you do a lot of Work in the global scope?
lemme check just a min
I have 2 service binding, and nothing else
just in case, I am using variables that are outside of a function I made them to be accessible for all inbound requesets
something like:
const myglobal = ["foo","bar"]
Static variables should be fine. However, calling an async function for a global may not work
I will remove them from my code, and check if it works.
can you tip me what do you mean about global scope?
For example, if you try to fetch data, it wouldn't work:
so you mean global scopes are possible to source of internal errors right?
If you perform I/O operations in the global scope, then yeah. I would think that it would give a more informative error, but if you are doing so now, you might want to try to remove it, and see if it fixes it
okay, I will refactor my code to see if it is the problem and keep you informed. I will contact you soon. Thank you a lot for help me. 😍