I have the below router that queries a data collection. It works, unless I add one additional import, in which case it returns a 500 timeout error.
import { ok, notFound } from "wix-router";
import wixData from 'wix-data';
// If I remove the below import, the page loads. With it, I get a 500 timeout error.
import wixUsers from "wix-users";
export async function myRouter_Router(request, response) {
return await wixData.query("myCollection")
.eq("_id", request.path[0])
.find()
.then((queryResult) => {
if (queryResult.length > 0) {
return ok("myRouter-page", queryResult.items[0]);
}
return notFound();
})
}
The difference is literally just this line:
import wixUsers from "wix-users";
Without it, the page loads. With it, I get the 500 error. I’m stumped. Any help would be appreciated. Thanks.