I have a canvas app which attaches the attachment to SharePoint document library including metadata. It was working fine until recently when I updated the code to extract filename without extension. When tried monitor to debug the issue, the error I'm seeing is "Invalid data from the network".

I'm able to attach the file to library, but metadata fields are not updating. This is the part of code I'm trying to use:
Set(varAttachementControl,JSON(Source.Image,JSONFormat.IncludeBinaryData));Set(varbase64,Mid(varAttachementControl,Find(",",varAttachementControl)+1,Len(varAttachementControl)-Find(",",varAttachementControl)-1));
Set(varlink,FileUpload.Run(Last(Attachments.Attachments).Name,varbase64).file_name);
Refresh('Project Library');
UpdateIf(' Project Library',Name=Substitute(Last(Attachments.Attachments).Name,"."&Last(Split(varlink,".")).Value,""),{'Project ID ':Project_Id.Text,'Project Name':Project_Name.Text,'Document Name':Last(Attachments.Attachments).Name,'Project Phase':Phase.Selected,'Document Description':'Document Desc'.Text,'Document Type':'Document Type_Value'.Selected});
Can anyone please help me with this.