Logic App SSH SFTP Connector- Bad Gateway (500)

CRASH4 1 Reputation point
2022-03-09T04:38:55.047+00:00

Hi,
I am using SSH SFTP connector in Logic App to connect to a SFTP Server on port 22 using User ID/Password (no ssh keys). The connector is successfully connecting to the path and listing the available files using the 'List Files in Folder' action. However when trying to read the contents of the files using 'Get File Content' or 'Get File Content using Path' actions, receiving a Bad Gateway exception as follows:

{
"error": {
"code": 500,
"source": "",
"clientRequestId": "352750b6-1d9c-4fe1-82e6-0e2ee3f2e916",
"message": "BadGateway",
"innerError": {
"status": 500,
"message": "Specified argument was out of the range of valid values.\r\nParameter name: length\r\nclientRequestId: 352750b6-1d9c-4fe1-82e6-0e2ee3f2e916",
"error": {
"message": "Specified argument was out of the range of valid values.\r\nParameter name: length"
},
"source": "sftpwithssh-ncus.azconn-ncus.p.azurewebsites.net"
}
}
}

There are no IP whitelisting required at the SFTP server and able to connect using WinSCP from multiple devices. Not sure if this is due to any limitations with the Connector and please advise any possible solutions
Note: I am able to connect and retrieve the above files using Azure Function using Renci.SshNet.dll library, but facing issues via Logic App SSH SFTP connector

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. AnuragSingh-MSFT 21,566 Reputation points Moderator
    2022-03-11T08:04:22.037+00:00

    Hi @CRASH4 ,

    Welcome to Microsoft Q&A! Thanks for posting the question.

    I tested a scenario using the SFTP - SSH connector in Logic Apps and it worked as expected and I was able to get the content of file back. I connecting to SFTP enabled Azure Blob Storage from Logic Apps using only the userid/password (and not the ssh keys)

    The limits for this connector are mentioned here, however I don't think that any of these might be related. The error message mentions:

    "Specified argument was out of the range of valid values.  
    Parameter name: length  
    clientRequestId: 352750b6-1d9c-4fe1-82e6-0e2ee3f2e916"  
    

    Based on my observation, there are no length related parameters as supplied in the activities/connector in Logic Apps. Can you please check if:

    1. Is the "File Path/File Name" huge? Can you please test with a smaller file name?

    2. Please check if the configuration of activities for "SFTP - SSH" look like below:

    182078-image.png

    3. Please check and ensure that there are no special/no-printable characters in the "File" or "File Path" fields.

    4. Since the error is 500, this is coming from the server side. Please check if there is a way to get more details of this error - especially, why does it not like the get content request.

    Please let me know if you have any questions.

    ---
    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.


  2. Alexey Voytsekhovskiy 0 Reputation points
    2023-01-20T21:39:12.04+00:00

    Guys, did you solve this issue? I am encountering the same while trying to get a file content. I can directly find its path via lookup button and its metadata but not its content. Any ideas?

    User's image

    At the previous tsep I receive its metada

    User's image

    But always get 500 error while trying to get its content

    User's image

    User's image

    Thank you

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.