When use ssh2 route assertion in task, it throws error: Request is not initialized
search cancel

When use ssh2 route assertion in task, it throws error: Request is not initialized

book

Article ID: 276150

calendar_today

Updated On:

Products

CA API Gateway

Issue/Introduction

Route via SSH2 Assertion: Request is not initialized

A scheduled task is configured to call a Policy-Backed Service Operation Policy Fragment every afew minute, to check outgoing SFTP connection to the target server. The task is truggered per defined frequency but the following error is reported in the gateway log:

2023-11-13T13:20:00.004-0500 INFO    11667 com.l7tech.server.policy.assertion.ServerAuditDetailAssertion: -4: [SFTP] Keep-alive: sftp://#####.#####.com
2023-11-13T13:20:00.004-0500 WARNING 11667 com.l7tech.external.assertions.ssh.server.ServerSshRouteAssertion: 9434: SSH routing error: Request is not initialized; nothing to route
2023-11-13T13:20:00.004-0500 WARNING 11667 com.l7tech.server.task.ScheduledPolicyRunner: 2520: Error in MFT Cluster Keep-alive scheduled task policy execution: Bad Request
2023-11-13T13:20:00.004-0500 WARNING 11667 com.l7tech.server: Executing background policy for scheduled task MFT Cluster Keep-alive

Policy Fragment:

The SSH2 (SFTP) route assertion  configuration does not contain any reference of  variable request. 

Environment

ssg 10.1 

Cause

The request is not initilized since this is a task fragment and does not receive a request. The assertion of SSH2 internally reference the request context variable (even the SSH2 assertion does not use the request). 

Resolution

To used the assertion in a task fragment, assign a dummy messge to request context variable before the SSH2 routing assertion.  

Example assertion: 

"Set Context Variable request as Message to empty"