Endpoint working on preview but not via browser?

Hi there! I'm having some problems with my worker instance, the endpoint seems to be working on the quick edit preview but not on the browser... Yes, I did deploy and I have no idea why this isn't working Doesn't seem to be a cache problem either here's the code I'm using:
// other endpoints that do work

if (pathname.startsWith('/propic')) {
const id = pathname.split("/")[2];
if (!id) {
return jsonResponse({ status: 'error', message: 'No user ID provided' }, 400, headers);
}

const userData = await fetchDiscordAPI(`users/${id}`);
if (userData && userData.avatar) {
const avatarURL = `https://cdn.discordapp.com/avatars/${id}/${userData.avatar}.png`;
return fetchAndRespond(avatarURL, 'image/png', headers);
} else {
return jsonResponse({ status: 'error', message: 'User has no avatar' }, 404, headers);
}
}

return jsonResponse({ status: 'error', message: 'Endpoint not found!' }, 404, headers);
} catch (error) {
return jsonResponse({ status: 'error', message: 'An error occurred' }, 500, headers);
}
}
// other endpoints that do work

if (pathname.startsWith('/propic')) {
const id = pathname.split("/")[2];
if (!id) {
return jsonResponse({ status: 'error', message: 'No user ID provided' }, 400, headers);
}

const userData = await fetchDiscordAPI(`users/${id}`);
if (userData && userData.avatar) {
const avatarURL = `https://cdn.discordapp.com/avatars/${id}/${userData.avatar}.png`;
return fetchAndRespond(avatarURL, 'image/png', headers);
} else {
return jsonResponse({ status: 'error', message: 'User has no avatar' }, 404, headers);
}
}

return jsonResponse({ status: 'error', message: 'Endpoint not found!' }, 404, headers);
} catch (error) {
return jsonResponse({ status: 'error', message: 'An error occurred' }, 500, headers);
}
}
I have deployed and updated everything, it seems to be completely missing the propic endpoint, it does work on the preview though..?
No description
No description
8 Replies
Erisa
Erisa16mo ago
Are you able to dump the response from Discord? Some Discord cdn endpoints block Workers, last I checked avatars didnt but.. Or is the issue in the Worker itself and I misunderstood?
Clip
ClipOP16mo ago
I have a second endpoint to fetch the entire json, that seems to be working at this point I believe it hasn't updated even after deploying? I just tried to change the "endpoint not found" error and after deploying it still hasn't changed, how long do changes take to propagate to the cloudflare CDN?
Erisa
Erisa16mo ago
Usually a few seconds unless there are issues, which I don't see any issues currently
Clip
ClipOP16mo ago
it still returns endpoint not found on my browser (and via fetch, on my website), on the quick edit preview it returns the image just fine
Clip
ClipOP16mo ago
Clip
ClipOP16mo ago
I'm not good enough at english to explain the problem properly, hopefully this video could help comprehend the issue better
Erisa
Erisa16mo ago
You're right, that is strange
Clip
ClipOP16mo ago
is there anything I could do to solve this? Hi there, are there any updates on the situation?
Want results from more Discord servers?
Add your server