-
As you know, The Online/Offline status update is little bit slow. Sometimes it takes over 10 minutes. So to solve this CORS Proxy's delay problem, I had to fork your project and deploy to Vercel. Because Vercel supports Serverless Function so the mini profile request could be faster and more accurate. But for some reason it doesn't work. (api/steamProfile.js)export default async function handler(req, res) {
const { steamId, language } = req.query;
const url = `https://steamcommunity.com/miniprofile/${steamId}?l=${language || 'koreana'}`;
if (req.method === 'OPTIONS') {
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
return res.status(204).end();
}
try {
const response = await fetch(url);
const data = await response.text();
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
res.status(200).send(data);
} catch (error) {
console.error('Error fetching data:', error);
res.status(500).json({ error: 'Error fetching data' });
}
} (index.html)
In Vercel's deployment logs, it shows the result that steamProxy.js got respond "200" perfectly, but I couldn't get any Steam profile information. Just only mini-profile's default frame. No nickname, no badges, no level, no on/offline status. I don't know how your corsUrl works exactly. I think serverless function is not the problem. Because some how, steamProxy.js getting respond 200 anyway. But index.html seems cannot bring mini-profile html information for some reason. Or just there's another problem. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Can you check that your Also I do not think that the delay in Online/Offline status update is due to the proxy. I'm sorry for the late reply, I did not see the notification about the discussions 🙏 . |
Beta Was this translation helpful? Give feedback.
I see the problem now.
Your code is working fine.
My proxy server has a mechanism to translate different types of ID into Steam's ID.
Yours does not have that mechanism so it could not find your profile.
Just use your normal
AccountID
(which can be found here https://steamdb.info/calculator/) and you should be fine:https://mini-profile-vercel-proxy.vercel.app/api/steam-proxy?accountId=94813573&lang=koreana
If you would like to see the ID translation code I can get that and explain how it works to you.
Have a nice day ☕ and please mark this as answer if it answered your question.