InstagramApiSharp icon indicating copy to clipboard operation
InstagramApiSharp copied to clipboard

Unknow Server Error when Uploading Img

Open bbday opened this issue 3 years ago • 7 comments

I use last library version 1.7.4 I using image uploading but i get "uknow server error" Image 340x425 With library version 1.7.2 i dont have this issue and posted img.

 var mediaImage = new InstaImageUpload
                    {
                        // leave zero, if you don't know how height and width is it.
                        Height = 0,
                        Width = 0,
                        ImageBytes = targetFile.Item1, // byte[] Img
                        //Uri = imgData
                    };

                    var result = await _instagramClient.MediaProcessor.UploadPhotoAsync(mediaImage, SettingModel.Instance.PostData);
                    if (result.Succeeded)
                    {
                        Console.WriteLine("[" + DateTime.UtcNow.ToShortTimeString() + "] posted Img");
                        File.Delete(targetFile.Item2);
                    }
                    else
                    {
                        Console.WriteLine("[" + DateTime.UtcNow.ToShortTimeString() + $"] Unable to upload : {targetFile.Item2} " + result.Info.Message);
                    }

bbday avatar Oct 27 '22 07:10 bbday

I have the same issue after upgrading to v1.7.4 - Error=Unknown: Unknown Server Error. Would be nice if we can get some feedback about how to fix it

CarlosTorrecillas avatar Nov 18 '22 11:11 CarlosTorrecillas

Hello, I have the same issue in this version v1.7.4.

fabiomoroni avatar Nov 23 '22 20:11 fabiomoroni

Hello, I have the same issue in this version v1.7.4. Any feedback about to fix it? I´m running on a console app with .net 7.

pavini avatar Feb 24 '23 18:02 pavini

The problem is the newly generated GenerateRandomUploadId produces an id that causes ConfigureMediaPhotoAsync to fail.

Changing GenerateRandomUploadId back fixes this

internal static string GenerateRandomUploadId()
{
    return DateTime.UtcNow.ToUnixTimeMiliSeconds().ToString();
   // return GenerateUploadId();
}

clamchoda avatar May 06 '23 05:05 clamchoda

a have same problem now so i will change version and error will be gone??

demetrebadzaradze avatar Aug 16 '23 18:08 demetrebadzaradze

a have same problem now so i will change version and error will be gone??

This issue is in the latest version I believe. In ApiRequestMessage.cs just replace the return value in GenerateRandomUploadId with return DateTime.UtcNow.ToUnixTimeMiliSeconds().ToString(); in the source or use a version prior to this commit.

clamchoda avatar Aug 16 '23 20:08 clamchoda

Getting the same issue. Can you please fix this in the next release? Currently using 1.7.2 to go around this issue. Thanks.

Beblia avatar Oct 28 '23 17:10 Beblia