cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

SFTP Create File Action Fails with Error Code 400 (Unknown Error)

Hello,

 

I am trying to read a file from Sharepoint and create that file on a SFTP server.

I am getting the following error.

 

{
"status": 400,
"message": "An unknown error occurred.\r\nclientRequestId: c99f7b17-1fbf-4296-a555-b9997ed22d04",
"source": "sftp-eus.azconn-eus.p.azurewebsites.net"
}
 
Although the flow ends in error, I see a zero byte file created on SFTP server. It just has no content in it. But there is content in the sharepoint while which I am trying to create on SFTP.
I am getting the same error when I am using Standard Flow Templates that create a file/attachment on SFTP server.
 
Here are some screenshots of my process:
 
1. Read File Metadata from PathGet_File_Metadata_Using_Path.png
2. Read File Content from Path
Get_File_Content_Using_Path.png
3. Create File SFTP
Create_File_SFTP_Part1.pngCreate_File_SFTP_Part2.PNG
 
Please help as I need this solution ASAP.
 
Thanks,
Ashwin Johari.
 
10 REPLIES 10
Dual Super User III
Dual Super User III

Hi @ashwinj9 

 

Can you post a screenshot of the flow too? 

Hi @yashag2255 ,

 

Here is the screenshot of the flow:

Flow.PNG

 

Also this is the screenshot of the file which got created, but it was a 0 byte file with no data.

 

File Created but no data.png

@ashwinj9 

 

I cannot see the actions/ the inputs you are passing in there. Can you please share the screenshot of teh expanded actions (barrign any sensitve information)

@yashag2255 ,

 

The expanded screenshots are all there in my original post.

Are you not able to view them?

 

Ashwin Johari.

The expanded screenshots are from the run history. I want to see the screenshot from the flow configuration (edit flow) part.

Apologies, 

 

Here you go:

 

The first step is manual trigger.

 

Flow Main.png

@ashwinj9 

 

Everything looks fine to me here. Can you confirm that you are selecting the folder path in the SFTP action by clicking the folder and then selecting the folder -> subfolder from there? 

 

If so, this could be a connection error (400 status) so can you delete your current connection to sftp and a new one and run the flow to check if you continue to get the same issue? 

 

Hope This Helps!

@yashag2255 ,

 

1. Can you confirm that you are selecting the folder path in the SFTP action by clicking the folder and then selecting the folder -> subfolder from there? 

Yes. That's how I am picking the folder.

 

2. If so, this could be a connection error (400 status) so can you delete your current connection to sftp and a new one and run the flow to check if you continue to get the same issue?

I have created the connection many times now, but getting the same error.

 

One thing I noticed is while writing other files to SFTP server, we use PGP encryption.

I am trying to give the Private Key and Fingerprint in the connection.

That might be a reason for the 0 byte file.

Hi @ashwinj9 ,

 

About your issue that 400 bad request, you could consider recreating a new connection. Creating an SFTP connection that uses a private key from within the Flow editor(After adding an SFTP action), not create it in the navigation bar of Flow. Please refer to this blog:

microsoft-ms-flow-sftp-connector-tips-tricks-errors

In addition, the size of the newly created file is 0, please check the following similar thread and see if it helps:

sftp-create-file-does-not-create-a-file-0-bytes-transfered

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-bacao-msft ,

 

Thanks for your inputs.

I learned more about the SFTP servers and found that the one I was trying to create the file into is encrypted.

I tried to give the private key for encryption but the format isn't matching to what is accepted by Flow.

 

Later, I tried to create the file on a non-encrypted SFTP server and the operation was successful.

So I am certain that the 0 byte file is because of the encryption.

 

I am trying out ways to try and encrypt the file in the right format to create it on an encrypted SFTP.

 

Thanks,

Ashwin.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (7,095)