Replies: 2 comments
-
@Reshmi-Sriram is Next.js method |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'm pretty sure you have to add the environment variables in the configuration settings in the Azure portal for the Static Web App when you are using getServerSideProps. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am not sure why the app works as expected on my local, but as soon it is published as a Static Web App on Azure, it throws a 500 Internal Server Error.
It is my first Next.js app on Azure. Perhaps I am missing something, a configuration, settings, etc. ?
Or,
Something wrong on my code?
Any way, your help will be appreciated.
Summary
I believe the problem is caused by
getServerSideProps
method from Next.js. In my application,getServerSideProps
calls a public API that returns a token (JWT) that is used in subsequent calls.What have a I tried
process.env.CPL_API_USER_PROD
andprocess.env.CPL_API_PSWRD_PROD
values on thegetCplApiToken
method. I got the 500 error.getStaticProps
from next.js, returnedprocess.env.CPL_API_USER_PROD
from it, then logged the variable value to the browser console. The correct value was logged, this worked on local and Azure.All of the environment variables are saved as gitHub secrets, and their names match the ones on my
.env.local
file.I commented the
getServerSideProps
code in my page.My code
While the code in the method called inside getServerSideProps is:
Yml file
Beta Was this translation helpful? Give feedback.
All reactions