You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unable to access the defined environment variables in the Next.js getServerSideProps() function.
To reproduce:
Create some new environment variables by going to Pages > your Pages project > Settings > Environment variables
Add the following code in your index.js file
exportconstconfig={runtime: 'experimental-edge',}exportasyncfunctiongetServerSideProps(){constfauna_secret=process.env.FAUNA_SECRET;constnode_env=process.env.NODE_VERSION;constproducts=awaitgetProducts();return{props: {
products,
fauna_secret,
node_env
},}}exportdefaultfunctionHome({ products, fauna_secret, node_env }){console.log(products);console.log('===>',fauna_secret);// will be undefinedconsole.log('===>',node_env);// will be undefinedreturn(<divclassName={styles.container}><h1>Products</h1>
...
</ul></div>)}
Deploy
Notice environment variables are going to be undefined
The text was updated successfully, but these errors were encountered:
Unable to access the defined environment variables in the Next.js
getServerSideProps()
function.To reproduce:
index.js
fileThe text was updated successfully, but these errors were encountered: