Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CreateJobAsync No Response #14

Open
wickedwick opened this issue Dec 22, 2021 · 3 comments
Open

CreateJobAsync No Response #14

wickedwick opened this issue Dec 22, 2021 · 3 comments

Comments

@wickedwick
Copy link

I have a simple conversion use case. But it seems that CreateJobAsync hangs. During troubleshooting, I implemented creating a job via RestSharp and it completes just fine. I am seeing the same behavior with UploadAsync, and WaitJobAsync. Any idea what I'm doing wrong here?

var job = await _cloudConvert.CreateJobAsync(new JobCreateRequest
{
    Tasks = new
    {
        import_it = new ImportUploadCreateRequest(),
        convert = new ConvertCreateRequest
        {
            Input = "import_it",
            Input_Format = inputFormat,
            Output_Format = outputFormat
        },
        export_it = new ExportUrlCreateRequest
        {
            Input = "convert"
        }
    }
});

var uploadTask = job.Data.Tasks.FirstOrDefault(t => t.Name == "import");
var bytes = File.StoredFileAsByteArray(storedFile);

await _cloudConvert.UploadAsync(
    uploadTask?.Result.Form.Url.ToString(),
    bytes,
    storedFile.Name,
    uploadTask?.Result.Form.Parameters);

job = await _cloudConvert.WaitJobAsync(job.Data.Id); // Wait for job completion

var exportTask = job.Data.Tasks.FirstOrDefault(t => t.Name == "export_it");

var fileExport = exportTask.Result.Files.FirstOrDefault();
return fileExport.Url.ToString();
@josiasmontag
Copy link
Contributor

You might need to use a debugger and check how exactly the API response looks like etc.

@wickedwick
Copy link
Author

I've been trying that to no avail. When I attach and set a breakpoint on the CreateJobAsync method then step into or over, nothing happens. There is no response, no exception is thrown, nothing happens.

@wickedwick
Copy link
Author

So it seems that I'm getting a deadlock on var response = await base.SendAsync(request, cancellationToken); in the WebApiHandler. Since I don't have a pdb of the SDK to debug, I implemented it in my project to step through. When I change it to var response = base.SendAsync(request, cancellationToken).Result;, then I avoid the deadlock and can see a response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants