'Creating a main account twilio client on a subaccount node function

I'm developing a twilio function on a subaccount that needs to acces a twilio client on the main account. The function is being deployed through a Github action to the subaccount.

For this, on the subaccount function I have:

const mainClient = new twilio(context.MAIN_TWILIO_ACCOUNT_SID, context.MAIN_TWILIO_AUTH_TOKEN);

Then I need to access serverless.services but I'm getting serverless undefined therefore can't access services.

i.e.

return mainClient.serverless.services(...

I tested code locally and it worked but failed on deployment. Is it possible to access services on main account from a subaccount function??

Thanks.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source