# Gateway message handler exists but logs show not found

**URL:** <https://forum.inductiveautomation.com/t/gateway-message-handler-exists-but-logs-show-not-found/89124>\
**Category:** Ignition\
**Tags:** scripting, ignition81\
**Created:** [April 19, 2024, 3:46pm UTC](https://forum.inductiveautomation.com/t/gateway-message-handler-exists-but-logs-show-not-found/89124 "2024-04-19T15:46:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![devty](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@devty](https://forum.inductiveautomation.com/u/devty)\
**Post date:** [April 19, 2024, 3:46pm UTC](https://forum.inductiveautomation.com/t/gateway-message-handler-exists-but-logs-show-not-found/89124/1 "2024-04-19T15:46:31Z")

</div>

Was wondering if anyone had ideas on how to troubleshoot this further. I have stripped the code down to the most basic sanity check and still get an issue. I have an onChange event for a tag that scoops up some text for tag paths and then sends the payload to gateway message handler. according to the logs I can see the on change event fire but when it dispatches the message it acts like nothing is listening but I can see the message handler in the gateway

## onchange script

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/6/a6476cc97ecc241d99c48d8601d3b209ee640bf7.jpeg)

## log output

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/7/3722fa7ec5bca9f1a917be2491e3b7705ee2ee3f.jpeg)

## message handler

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/2/c2bd857bb80fa7a6c8576b5f9132c9474e75e6cb.png)

---

<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:** [April 19, 2024, 4:00pm UTC](https://forum.inductiveautomation.com/t/gateway-message-handler-exists-but-logs-show-not-found/89124/2 "2024-04-19T16:00:03Z")

</div>

Is the message handler in an inheritable project? Those don't actually run anything. You need a leaf project to run actual code/handle messages. (With one exception: non-project objects can call **functions** in the gateway scripting project even if it is inheritable.)

---

<div class="post-metadata">

**Author:** ![devty](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@devty](https://forum.inductiveautomation.com/u/devty)\
**Post date:** [April 19, 2024, 4:23pm UTC](https://forum.inductiveautomation.com/t/gateway-message-handler-exists-but-logs-show-not-found/89124/3 "2024-04-19T16:23:03Z")

</div>

From what I understand the gateway I am working on only has one project.

Since I scoped my sendMessage with "G" and the handler name matches on sendMessage and Gateway Messages handler I should be able to log out the payload passed to it like in my example right?

---

<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:** [April 19, 2024, 4:27pm UTC](https://forum.inductiveautomation.com/t/gateway-message-handler-exists-but-logs-show-not-found/89124/4 "2024-04-19T16:27:46Z")

</div>

If you only have one project, why are you bothering with message handlers? Just make sure the one project is the gateway scripting project. Then your tag events can simply call the functions in your project script library directly.

(Message handlers, like any other event, should always be one-liners delegating to a project library script function.)

---

<div class="post-metadata">

**Author:** ![devty](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@devty](https://forum.inductiveautomation.com/u/devty)\
**Post date:** [April 19, 2024, 6:43pm UTC](https://forum.inductiveautomation.com/t/gateway-message-handler-exists-but-logs-show-not-found/89124/5 "2024-04-19T18:43:18Z")

</div>

I didn't know about that setting in the gateway. That was the exact reason I went after messages was to have an onChange event trigger some project library code. Thanks for the shortcut.
