Problem
POST /api/v2/instances/{id}/restart on a gupshup channel instance always returns:
{"error":{"code":"RESTART_FAILED","message":"Failed to restart: gupshupCallbackUrl is required"}}
…even when gupshup_callback_url is fully populated in the DB row and GET /instances/{id} returns the URL correctly. The restart endpoint appears to validate against the plugin's connectionOptions (which is empty/partial after the instance is already connected) instead of reading from the persisted instance row.
Repro
# 1. Confirm callback URL is set on the row
curl -s -H "x-api-key: <KEY>" \
"https://<OMNI_HOST>/api/v2/instances/<INSTANCE_ID>" | jq '.data.gupshupCallbackUrl'
# -> "https://notifications.gupshup.io/notifications/callback/service/ipaas/project/<PROJ>/integration/<INT>"
# 2. Try restart
curl -s -i -X POST -H "x-api-key: <KEY>" \
"https://<OMNI_HOST>/api/v2/instances/<INSTANCE_ID>/restart"
# -> HTTP/2 200
# -> {"error":{"code":"RESTART_FAILED","message":"Failed to restart: gupshupCallbackUrl is required"}}
Workaround
disconnect + connect works and triggers a full plugin re-init (the plugin reads from the row on reconnect):
curl -X POST -H "x-api-key: <KEY>" .../instances/<INSTANCE_ID>/disconnect # {"success":true}
curl -X POST -H "x-api-key: <KEY>" .../instances/<INSTANCE_ID>/connect -d '{}'
# -> {"data":{"status":"connecting","message":"Connection initiated"}}
After reconnect, GET /status returns state: connected and the plugin picks up any fields PATCHed in the meantime (e.g. gupshupAuthToken, gupshupEventId).
Suspected cause
restartInstance() probably calls plugin.connect(connectionOptions) where connectionOptions is what was passed to the original /connect request (often {} for gupshup, since channel-specific config lives on the instance row). Need to hydrate connectionOptions from the persisted instance row before re-invoking the plugin, or change the plugin contract so restart reads directly from the row.
Environment
- omni server
2.260531.5
- channel
gupshup (Custom Integration variant)
- HML deployment
Problem
POST /api/v2/instances/{id}/restarton agupshupchannel instance always returns:{"error":{"code":"RESTART_FAILED","message":"Failed to restart: gupshupCallbackUrl is required"}}…even when
gupshup_callback_urlis fully populated in the DB row andGET /instances/{id}returns the URL correctly. The restart endpoint appears to validate against the plugin'sconnectionOptions(which is empty/partial after the instance is already connected) instead of reading from the persisted instance row.Repro
Workaround
disconnect+connectworks and triggers a full plugin re-init (the plugin reads from the row on reconnect):After reconnect,
GET /statusreturnsstate: connectedand the plugin picks up any fields PATCHed in the meantime (e.g.gupshupAuthToken,gupshupEventId).Suspected cause
restartInstance()probably callsplugin.connect(connectionOptions)whereconnectionOptionsis what was passed to the original/connectrequest (often{}for gupshup, since channel-specific config lives on the instance row). Need to hydrateconnectionOptionsfrom the persisted instance row before re-invoking the plugin, or change the plugin contract sorestartreads directly from the row.Environment
2.260531.5gupshup(Custom Integration variant)