robbiepaul / cloudconvert-laravel

A Laravel wrapper for the CloudConvert API
177 stars 34 forks source link

Cannot save on Amazon S3 #20

Closed bachras closed 8 years ago

bachras commented 8 years ago

Hi, I am trying to convert file from input and save it on S3.

CloudConvert::file($file)->to(CloudConvert::S3('hello.mp4'));

For some reason it treats s3 as an output format and gives me an error:

{"error":"This conversiontype is not supported!","code":400}

Client->request('post', 'https://api.cloudconvert.com/process', array('json' => array('inputformat' => 'mp4', 'outputformat' => 's3', 'apikey' => 'apikey'), 'synchronous' => true))

I am really struggling here, I would appreciate any help. Thanks

robbiepaul commented 8 years ago

What's the value of $file? Can you check what version of Guzzle you're using? I only recently wrote the Guzzle 6 Adapter and it has some issues I'm working through

robbiepaul commented 8 years ago

I've pushed a new release with a fix for this b126972e9b01940ccf19dd1bd3f6183a7bbf4d24 Just run composer update robbiep/cloudconvert-laravel

Please let me know if it fixes your issue

bachras commented 8 years ago

Thank you for quick reply and appreciate your help. Initial issue has been fixed in new release but now I have different error with guzzle.

InvalidArgumentException in functions.php line 113: Invalid resource type: array

in functions.php line 113 at GuzzleHttp\Psr7\stream_for(array('accesskeyid' => 'accesskeyid', 'bucket' => 'inlinx-01', 'path' => 'hello.mp4', 'acl' => 'public-read', 'region' => 'eu-west-1')) in MultipartStream.php line 87 at MultipartStream->addElement(object(AppendStream), array('name' => 'output[s3]', 'contents' => array('accesskeyid' => 'accesskeyid', 'secretaccesskey' => 'secretaccesskey', 'bucket' => bucket', 'path' => 'hello.mp4', 'acl' => 'public-read', 'region' => 'eu-west-1'))) in MultipartStream.php line 70

I am using latest Guzzle version. You said that you are working through some issues. Are they related to my issue? Should I install older version for time being?

Thank you for help once again.

robbiepaul commented 8 years ago

Thanks for the report. I'd recommend using Guzzle 5 until I can get a fix out for my Guzzle 6 adapter.

robbiepaul commented 8 years ago

@bachras I've updated the Guzzle 6 Adapter. Will you run another update on my package and let me know if it's fixed your issue? Thanks

bachras commented 8 years ago

Thanks for prompt response. I have updated the package and no I can upload on Amazon S3 but there is one issue left. Once I sent a POST request to convert and upload a file and don't get a response with status 200 even the file is successfully uploaded. After some time I get 500 error:

The FastCGI process exceeded configured activity timeout

I have checked with smaller 1MB video files as well, but it is the same story. File is uploaded within 30 seconds but 500 error comes after another minute.

Could you help me with this issue?

Thank you for your assistance.

bachras commented 8 years ago

@robbiepaul I just wanted to check if have you had time to look into the above issue as I could not resolve it myself. Many thanks.

robbiepaul commented 8 years ago

I haven't had a chance to look in to it yet.

Does it only timeout when you choose S3 as an output? What about saving to disk?

bachras commented 8 years ago

Yes it only timeouts with S3 output. Save on disk works properly. I also tried to convert file on disk and save on S3 but I had a same problem. The file is saved within 20 seconds and timeout error comes after another minute.It seems that problem only comes using S3 option. I would be grateful if you could look into my issue when you will have some spare time as I would like to get a paid account on cloudcovert on use this API on production level. Thanks

robbiepaul commented 8 years ago

Yeah I should have a chance soon. I just need to dig out my S3 keys

robbiepaul commented 8 years ago

I've issued a fix and Amazon S3 seems to be working for me now. See 10cf8ad8d2a535eee6014eef76ad54ec09b48ca6

Can you run composer update robbiep/cloudconvert-laravel and let me know if it fixes your issue as well?

bachras commented 8 years ago

Thank you very much. My issue is fixed. Now I am trying to use 'Non-blocking conversion using a callback URL', I followed the instructions but my file is not saved. Process is create, I can check the url but file is not saved. Maybe I am doing something wrong, could your check this at your convenience? If it is working for you, could you guide me through the process. Thanks again for fixing the issue again. I will wait for your response. Cheers

robbiepaul commented 8 years ago

Yeah I know the callback URL is working for other people. If you create a new issue with the exact code you're using, I'll try and help