ChatGPT-Next-Web icon indicating copy to clipboard operation
ChatGPT-Next-Web copied to clipboard

[Bug] Setting environment variables is ineffective

Open Anivie opened this issue 6 months ago • 9 comments

Describe the bug Try to deploy this app in my vercel, it can runs normally but I found that it will ignore env variable BASE_URL.

To Reproduce Steps to reproduce the behavior:

  1. Go to Vercel
  2. Set env variables "BASE_URL"
  3. Deploy
  4. See error

Expected behavior When sending a request, NextWeb does not send it through the set environment variables. Instead, it initiates the request to the domain name in the webpage.

Screenshots 18718891f9673f1a4d595cead52391c6

Deployment

  • [ ] Docker
  • [X] Vercel
  • [ ] Server

Anivie avatar Feb 12 '24 05:02 Anivie

this hard to fix for me tbh, because it must dealing with the complexity

alternative to prevent this issue just use a custom url in this settings

image

H0llyW00dzZ avatar Feb 12 '24 09:02 H0llyW00dzZ

this hard to fix for me tbh, because it must dealing with the complexity这对我来说很难修复,因为它必须处理复杂性

alternative to prevent this issue just use a custom url in this settings避免此问题的替代方法是在此设置中使用自定义URL

image

This can solve the problem, but it completely abandons environmental variables. Could you tell me more about 'complexity'?Is this an issue caused by Vercel?

Anivie avatar Feb 12 '24 09:02 Anivie

this hard to fix for me tbh, because it must dealing with the complexity这对我来说很难修复,因为它必须处理复杂性 alternative to prevent this issue just use a custom url in this settings避免此问题的替代方法是在此设置中使用自定义URL image

This can solve the problem, but it completely abandons environmental variables. Could you tell me more about 'complexity'?Is this an issue caused by Vercel?

Not only Vercel , but you'll also need to refactor the codebase. For instance, modifications will be necessary in server.ts and potentially in the LLM API located in router.ts.

anyways its kinda stupid and so bad especially for front end about stupid complexity

H0llyW00dzZ avatar Feb 12 '24 11:02 H0llyW00dzZ

so basically if you want to know about complexity, that's it it literally so hard to maintain, especially fix bugs or improvement

H0llyW00dzZ avatar Feb 12 '24 11:02 H0llyW00dzZ

@Anivie The reason for this is that forwarding is expected on the nextjs server. This is because if forwarding is not done through the server, which will lead to cross-domain problems.

The current request should be: Client Side(Next.js) → Server Side(Next.js) → Model Provider(e.g. BASE_URL)

fred-bf avatar Feb 12 '24 12:02 fred-bf

If you have any other questions about forwarding to 'BASE_URL' through the server, you can continue to add additional comments.

fred-bf avatar Feb 12 '24 12:02 fred-bf

If you have any other questions about forwarding to 'BASE_URL' through the server, you can continue to add additional comments.

Thank you for your enthusiastic response. I've been trying to pinpoint where the error occurred, but as the gentleman above mentioned, it's quite complex.

Anivie avatar Feb 12 '24 17:02 Anivie

If you have any other questions about forwarding to 'BASE_URL' through the server, you can continue to add additional comments.

Thank you for your enthusiastic response. I've been trying to pinpoint where the error occurred, but as the gentleman above mentioned, it's quite complex.

Hahahaha, Did you find any solution to fix it when trying to pinpoint where the error occurred ?

H0llyW00dzZ avatar Feb 12 '24 18:02 H0llyW00dzZ

If you have any other questions about forwarding to 'BASE_URL' through the server, you can continue to add additional comments.

Thank you for your enthusiastic response. I've been trying to pinpoint where the error occurred, but as the gentleman above mentioned, it's quite complex.

The behavior meets expectation because NextChat client need to forward request to Next.js server side first to avoid CORS issues, the original 503 error should be coming from the "BASE_URL" server you've configured

fred-bf avatar Feb 27 '24 09:02 fred-bf