Problem with Netlify? #3782
Unanswered
akiarostami
asked this question in
Q&A
Replies: 3 comments 4 replies
-
I don't know much about it, but have you tried adapter-netlify? Maybe it can fix your problem. |
Beta Was this translation helpful? Give feedback.
0 replies
-
There's not enough detail here to help you. Are there any details in the Netlify function logs showing a stack trace of what the 500 error is? Can you provide an application to reproduce the issue? |
Beta Was this translation helpful? Give feedback.
2 replies
-
I finally found out what the problem was It's coming from loading environment variables. It seems that when I load dotenv on the server, I get this error.
Is there any good example of how to use environment variables on the server without exposing them to the client?
See, when you pulish your app to netlify, or any other hosting platform,
there is no way it can read your private environment variables.
This is because you add .env files to .gitignore so it’s not possible for
hosting providers to know.
Under each project, there will be a setting (in netlify, which is your case
for example) to add environment variables. I am not sure but maybe its
`settings`>`environment variables` in your project dashboard.
So you have to manually add those environmental variables, and redeploy
your site. So this way netlify knows the variables and can use them server
side without exposing to client.
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a very simple app that I used to run on Netlify. At some point and after one of the updates (I don't know which one!), I could not log in to the site anymore. When I call a local endpoint, I get error 500 (server error).
Everything works fine on my local machine, and when I deploy on Netlify, I can't call the endpoint. The strange thing is I can call the endpoint from postman or any other tool, but calling it from sveltekit on the same site returns error 500.
After days of trying to fix the issue, I decided to try it on Vercel, and everything worked fine!
You can see the same code running on Netlify vs Vercel (you can enter any email there). Check the browser console for more info. And this is my Netlify toml file (I tried different variations of toml file as well):
Any idea what is wrong? I hope this is not a coup against Netlify, now that Vercel is backing Svelte... 😁 (just kidding).
Beta Was this translation helpful? Give feedback.
All reactions