Router Shows Forbidden Page and then Change it to OK 200 Response (maybe a BUG)

In fact there are no errors but there is a big UX error for my users.

What’s happening:
I have a router page which I use with a HTTP Function but error is all about it self (%99) and like I said it’s not an error maybe it’s a bug of Wix (maybe).

When user went into router page first router shows to user forbidden message after few seconds router remove the forbidden message and redirect user to page and everything works. So why if everything already works why router shows a forbidden page??

router.js

export async function download_product_Router(request) {
    //Getting all queries coming from HTTP response (301)
    const incomingMemberIp = request.query.memberIp;
    const incomingMemberId = request.query.memberId;
    const token = request.query.token;
    const productId = request.query.productId;

    if (incomingMemberIp === request.ip && incomingMemberId === request.user.id) {
        //Checking if the token is valid and for this user or not
        const isTokenValid = await checkToken(token, incomingMemberId, productId);
        //Gets product image
        const productImage = await findProductImage(isTokenValid.productId);

        if (isTokenValid.valid === true) {
            //Creating the data that we will send to frontend via router
            const routerData = {
                'token': isTokenValid.token.encryptedToken,
                'tokenId': isTokenValid.token._id,
                'productImage': productImage,
                'memberIp': incomingMemberIp,
                'memberId': incomingMemberId,
                'downloadUrl': request.url,
                'env': request.env
            }

            //Redirect to the Download Product page with ok reponse
            return ok("Ürün İndirme", routerData);
        } else {
            return forbidden();
        }
    } else {
        return forbidden();
    }
}

Here is the video of what actually happening:

As you can see in the router.js there are only two forbidden and after these forbidden response there is nothing. But somehow router changes it into 200 after forbidden and everything works like I said. But I don’t want to see this 403 page.

I don’t think you need (because this should be a bug of Wix or any error should be related to router.js) but if you need my HTTP Function code let me know.

(You can’t try this live, this is a live system I can’t do any changes on it)

I’ll be trying to fix this if I understand what was the reason and if I can fix it I’ll post here.

Update!


I think this is a BUG and source is Wix’s codes not mine. I tried it for more times without any changes and sometimes I don’t get this 403 page and sometimes I get it.

When I don’t get 403 page there are no errors on console.
When I get 403 page there are some errors related to Wix’s codes. About site info as I understand.

(I don’t use AdBlock)

So anyone from Wix can help me about this why I have this errors do I need to do something about this?