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
Hard@Work
Hard@Work4w ago
@Ashkan do you have an example repo somewhere, or something I can test with to see what errors you are getting?
Ashkan
AshkanOP4w ago
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
Hard@Work
Hard@Work4w ago
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
Ashkan
AshkanOP4w ago
No description
Hard@Work
Hard@Work4w ago
Does this happen with a default Worker on the account?
Ashkan
AshkanOP4w ago
No description
Ashkan
AshkanOP4w ago
yup I have a a single worker
Hard@Work
Hard@Work4w ago
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?
Ashkan
AshkanOP4w ago
no it's a complex script that I push it via wrangler to my dashboard
Hard@Work
Hard@Work4w ago
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
Ashkan
AshkanOP4w ago
I made my worker via wrangler CLI and made the worker and wrangler login -> wrangler deploy --minify
Hard@Work
Hard@Work4w ago
Yes, but if you go and create a new Worker, with just the basics, does it work?
Ashkan
AshkanOP4w ago
actually I haven't tried it yet, should I try that? I mean bypass wrangler and go directly to dashboard worker creation?!
Hard@Work
Hard@Work4w ago
Yeah. Don't deploy your large Worker yet. Just see if a standard "Hello World" Worker works first
Ashkan
AshkanOP4w ago
I have 3-4 script in my dashboard and they are working as expected just this worker that is most complex one
Hard@Work
Hard@Work4w ago
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?
Ashkan
AshkanOP4w ago
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"]
Hard@Work
Hard@Work4w ago
Static variables should be fine. However, calling an async function for a global may not work
Ashkan
AshkanOP4w ago
I will remove them from my code, and check if it works. can you tip me what do you mean about global scope?
Hard@Work
Hard@Work4w ago
For example, if you try to fetch data, it wouldn't work:
// This works
const data = "foobar";
// This does not
const data = await fetch("https://foo.bar");
// This works
const data = "foobar";
// This does not
const data = await fetch("https://foo.bar");
Ashkan
AshkanOP4w ago
so you mean global scopes are possible to source of internal errors right?
Hard@Work
Hard@Work4w ago
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
Ashkan
AshkanOP4w ago
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. 😍

Did you find this page helpful?