APIs & Integrations

RobertMarinho
Teilnehmer/-in

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

lösung

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 Akzeptierte Lösungen
RobertMarinho
Lösung
Teilnehmer/-in

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

lösung

@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,

 

Lösung in ursprünglichem Beitrag anzeigen

AChong6
Lösung
Teilnehmer/-in

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

lösung

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. 

Lösung in ursprünglichem Beitrag anzeigen

5 Antworten
RobertMarinho
Teilnehmer/-in

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

lösung

lol 😂 Never watched It. That was funny.

Thanks for sharing!

RobertMarinho
Lösung
Teilnehmer/-in

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

lösung

@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
Lösung
Teilnehmer/-in

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

lösung

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-Produktteam
HubSpot-Produktteam

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

lösung

@RobertMarinho ever watch the IT crowd? 🤣

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

0 Upvotes
dennisedson
HubSpot-Produktteam
HubSpot-Produktteam

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

lösung

@RobertMarinho ,

Are you still having issues with this?

0 Upvotes