Router Randomly No Longer Working

I’ve recently implemented routers for my site. I have a dashboard router layout like this:


My /dashboard router was working okay before but was kind of buggy where the odd time it would give a 500 but now it just doesn’t work at all even when im returning a simple ok() as above. It is now only returning a 500 and I’m very confused as to why.

I have tried renaming the router, removing the pages from the router and adding them back and nothing seems to be working. I have also tried passing in empy objects for the page data and HTML head parameters but still nothing works.

Am I missing something obvious here?

A small screenshot of part of your code is not enough for the community to be able to help you. Please include more information, code (posted here in a code block), and explanation of what you are trying to do.

All the code necessary to understand the problem is in that screenshot but apologies for not including a code snippet.
Here is the full code snippet with the comments removed:

export async function dashboard_Router(request) {
 return ok(request.pages[0]);
}

All I am trying to do is get a router working which was previously working with more complex logic but now is not working with even such a simple promise return. The pages I have as part of the router are shown in the sidebar of the picture above along with the name of the router. The name endpoint is “/dashboard”.

What I can’t wrap my head around is why it randomly stopped working and is no longer working with something simple as this example?

You say that " was working okay before but was kind of buggy where the odd time it would give a 500" which seems to indicate that it in fact wasn’t working before. An Error 500 indicates that something not good is happening. What were you trying to do before? Has anything changed.

What is request.pages when entering the router function? Perhaps the other backend imports are causing an issue? Maybe comment those out as well.

If you continue to have problems, please post the URL of your site. Only authorized Wix personnel can get access to your site in the editor. Please include the names of the pages involved.

Thank you for the suggesting of removing the imports. I found that one of my imports was causing an issue. Unsure as to why but the recreation of that web module fixed it with just copy and pasting the code over. I think I want to avoid using web modules in backend code from now on and only use .js files. Thank you once again!

Correct - calling web modules (jsw) in backend code won’t work. You can only call js files.