React or NextJS implementation #63
-
Apologies in advance for my ineptitude. My API skills are sketchy at best. I believe that I'm on the right track with this in NextJS, but I don't get any output from this:
Console log is
Could anybody point me in the right direction? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hey @mettamyron, sorry for the late reply. I was doing a test based on your code and can replicate it. You are getting 401 HTTP code because your BMC Access Token is undefined. However, I don't have general expertise in Next.js. With the help of this Stackoverflow question, I found the answer to your question. You'll need to define the environment to your const nextConfig = {
env: {
BMC_ACCESS_TOKEN: process.env.BMC_ACCESS_TOKEN,
},
}; After it works, you should be able to console log your environment variables. |
Beta Was this translation helpful? Give feedback.
-
I finally got this working, so just putting the answer here.
} |
Beta Was this translation helpful? Give feedback.
I finally got this working, so just putting the answer here.
I had to make the env variable public for NextJS (NEXT_PUBLIC) and target the data node. Otherwise straightforward.