S3 Lite plugin download error

Greetings,

I purchased S3 Lite and built it according to the documentation, but it seems to have some problems in the download section.

When downloading to 100% will appear error ↓

[Failed to rename temp download file to final download file] 

I saw other people in the corona forums asking the same question, but he didn’t get an answer. 

This is Error logger,

23:10:48.841  bad argument #1 to ‘find’ (string expected, got table)

23:10:48.841  stack traceback:

23:10:48.841   [C]: in function ‘find’

23:10:48.841   ?: in function ‘ParseXmlText’

23:10:48.841   ?: in function ‘get_error_msg’

23:10:48.841   ?: in function <?:384>

Is there any way to solve this problem?

Thank you.

 

Well, I’m not familiar with the plugin, but what sort of variables or data did you insert into the function? That error message is stating that you tried to insert a table even though the input should have been a string.

Thank you for your response, the documentation for the plugin. ↓

https://develephant.github.io/s3-lite-plugin/

I follow the documentation to replace bucket_name:“TestBuket”, and object_key is like this: “Test/TestMusic.mp3”

And dest_path is like this: “s3://TestBuket/Test/TestMusic.mp3”.

I gave a .txt and .mp3 respectively to try, both have problems, and txt is downloaded in less than 1 second, mp3 is 6 seconds, which should indicate that it has received the object correctly?

But it is a mistake when it reaches 100%.

I tried to empty the onDownload function, but the problem remains.

Are you using the sample function on the docs https://develephant.github.io/s3-lite-plugin/api/#getobject?)
 

local function onGetObject( evt ) if evt.error then print(evt.error, evt.message, evt.status) else if evt.progress then print(evt.progress) else print("object download complete") end end end

If not, give it a go.

If you did, then also I presume that you using “s3:getObject(bucket_name, object_key, base_dir, dest_path, listener)”? In this case, probably the reason why you are seeing this error is because of your dest_path, i.e. “s3://TestBuket/Test/TestMusic.mp3”. It tries to save the file to a location it cannot access and therefore it fails at that point.

We are talking about a Corona project, so the system.DocumentsDirectory is pointing to a the simulator’s sandbox (if you are on simulator) or the project’s Documents folder. Try changing the dest_path to “testMusic.mp3” and then open your project’s sandbox and look inside the documents folder to see if it is there.

Thank you very much, I can find the file in the sandbox correctly after you modify it.

But there are still some minor problems, and the bottom of the error will still appear after successful download.↓

bad argument #1 to ‘find’ (string expected, got table)

22:56:10.080  stack traceback:

22:56:10.080  [C]: in function ‘find’

22:56:10.080  ?: in function ‘ParseXmlText’

22:56:10.080  ?: in function ‘get_error_msg’

22:56:10.080  ?: in function <?:384>

However, when I put it on the phone and tested it, it works fine.

Does this mean that I can ignore this error message?

Errors are rarely safe to ignore, but without having access to your project and/or a deeper knowledge of the plugin and its workings, I can’t really help you weed out that problem with just this information.

You can try debugging it yourself or contact the plugin’s developer for help.

Ok, now it’s working fine on the phone, thank you very much for your help.

Thank you. :smiley: