process.env.API_KEY not working on next-on-netlify deployment

Change the code to (data || []) ?

If there is data, let it be data; otherwise an empty array.

How would this solve the problem?

This is a NOT a problem with my code.

This is a problem on how to correctly use environment variables on Netlify.

There is an earlier thread:

But since I am specifically using next-on-netlify for deployment, I opened the issue.

Any help on this would be highly appreciated.

Thanks.