Open huwan opened 1 week ago
Hi Hu Wan,
Thanks so much for reaching out!
Just wanted to explain the situation - while your code looks perfect, and you're absolutely right that deployment would go to HK servers for users in the Asia region, we've run into a small snag. The screening feature you're trying to use is actually part of Vercel's Enterprise tier, which is meant for larger organizations (they typically spend around $50k-200k USD per month 😅). Since you're not on an Enterprise account, the deployment would unfortunately fail. While I can't merge the code this time, I really appreciate you taking the time to contribute! Feel free to bounce any other ideas off me anytime.
You can find it here:
Looking forward to our next chat!
Best Loki
Thank you for the detailed explanation. I added a single iad1
region to specify the edge region with my Vercel hobby plan, and it seems to work when accessing the proxy API URL in HK. Hopefully, we can find a better and more affordable solution later. Thanks again.
Hi Hu Wan,
Great news! 🎉
I did some testing on your idea and found something interesting - turns out we can actually specify a single region without an Enterprise account! The limitation only kicks in when we try to deploy to multiple regions. I've gone ahead and updated the code using vercel.json configuration, keeping things clean without touching the main files. This approach should work perfectly for what we need.
Thanks again for bringing this to our attention - it helped us find a better way forward.
Best, Loki
According to Vercel's documentation on configuring regions for functions, the vercel.json
file is used for Serverless Functions. For Edge Functions, we might need to specify a regions key within a config object in pages/api/proxy.ts
to set the execution region for proxy functions, though this could cause issues when deploying on different platforms. I'm not sure. Looking forward to your test results and fix.
When deploying on Vercel and accessing the proxy API from Hong Kong, users encounter the "OpenAI proxy country, region, or territory not supported" error. This issue arises because Vercel's Edge Functions default to executing in the region closest to the incoming request, which is
hkg1
for Hong Kong.To resolve this, the Vercel edge network region
hkg1
should be explicitly excluded by configuring the function to use only supported regions. This can be done by modifying thepages/api/proxy.ts
file in the repository to include a list of supported regions.https://github.com/Herm-Studio/StakeVladDracula/blob/44295c9c5c64657e301633958c454b30d6dae044/pages/api/proxy.ts#L3-L5
References: