APIs & Integrations

RobertMarinho
Participant

Getting APIKEY undefined on serverless functions via process.env (Loca

SOLVE

Hello all,

I´m not able to get theprocess.env.APIKEY on serverless functions locally.

 

I´ve added the APIKEY through hs secrets add command:

RobertMarinho_1-1633097838909.png

After running the local server secrets env are all set:

RobertMarinho_2-1633098579812.png

 

On the code I´m loggin the APIKEY and the API response to some request:
RobertMarinho_4-1633099334848.png

 

Since APIKEY is undefined the hapikey is not present in the query params.
That´s the result I get:
RobertMarinho_3-1633098872219.png

 

Anyone also having this issue?

Thanks,

 

 

0 Upvotes
2 Accepted solutions
RobertMarinho
Solution
Participant

Getting APIKEY undefined on serverless functions via process.env (Loca

SOLVE

@dennisedson 

I´m not having issues with this anymore.

I´m wondering If It was just a problem on my end.

I´ve updated @hubspot/cli from 3.0.8 to 3.0.9. and It started working again.

Thanks,

 

View solution in original post

AChong6
Solution
Participant

Getting APIKEY undefined on serverless functions via process.env (Loca

SOLVE

For others, be sure to CAPITALIZE your environment variable names and you can also find the secret in the context parameter of exports.main, if process.env is not working for you. 

View solution in original post

5 Replies 5
RobertMarinho
Participant

Getting APIKEY undefined on serverless functions via process.env (Loca

SOLVE

lol 😂 Never watched It. That was funny.

Thanks for sharing!

RobertMarinho
Solution
Participant

Getting APIKEY undefined on serverless functions via process.env (Loca

SOLVE

@dennisedson 

I´m not having issues with this anymore.

I´m wondering If It was just a problem on my end.

I´ve updated @hubspot/cli from 3.0.8 to 3.0.9. and It started working again.

Thanks,

 

AChong6
Solution
Participant

Getting APIKEY undefined on serverless functions via process.env (Loca

SOLVE

For others, be sure to CAPITALIZE your environment variable names and you can also find the secret in the context parameter of exports.main, if process.env is not working for you. 

dennisedson
HubSpot Product Team
HubSpot Product Team

Getting APIKEY undefined on serverless functions via process.env (Loca

SOLVE

@RobertMarinho ever watch the IT crowd? 🤣

https://youtu.be/nn2FB1P_Mn8?t=11

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

Getting APIKEY undefined on serverless functions via process.env (Loca

SOLVE

@RobertMarinho ,

Are you still having issues with this?

0 Upvotes