# ServiceConnector contexte

**URL:** <https://forum.inductiveautomation.com/t/serviceconnector-contexte/116890>\
**Category:** Module Development\
**Created:** [August 25, 2026, 3:36pm UTC](https://forum.inductiveautomation.com/t/serviceconnector-contexte/116890 "2026-08-25T15:36:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![r.lebohec](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/r.lebohec/32/3704_2.png) [@r.lebohec](https://forum.inductiveautomation.com/u/r.lebohec)\
**Post date:** [August 25, 2026, 3:36pm UTC](https://forum.inductiveautomation.com/t/serviceconnector-contexte/116890/1 "2026-08-25T15:36:11Z")

</div>

I created a new cloud connector by implementing `ServiceConnectorExtensionPoint` / `ServiceConnector`.  
During module startup, the `getExtensionPoints` function is called before the `setup` function of the `ModuleHook` class.  
As a result, the `ServiceConnector` instances are created without the `GatewayContext` that is required for the connector to work properly.

What would be the proper way to pass the `GatewayContext` (init at setup() ModuleHook) to the `ServiceConnector` instances?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 25, 2026, 3:41pm UTC](https://forum.inductiveautomation.com/t/serviceconnector-contexte/116890/2 "2026-08-25T15:41:33Z")

</div>

Construct your object in your gateway hook (without a GatewayContext parameter), store a reference to it, and then inject the GatewayContext you get at `setup()` into your object in a separate setup method.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 25, 2026, 5:05pm UTC](https://forum.inductiveautomation.com/t/serviceconnector-contexte/116890/3 "2026-08-25T17:05:41Z")

</div>

That is, do some setup-ish tasks in your hook's constructor, then pass your hook instance to your extension points instead of passing the context. When the extension point is invoked, use the stored hook instance to retrieve the context.
