Third Light Developer Exchange

Code and templating community forum for developers and software integrators

You are not logged in.

Announcement

If you wish to join the Developer Exchange, please contact your account manager - this is to avoid unnecessary spam in the forums. Many thanks for your understanding.

#1 2015-07-07 10:40:54

satishd
Member
Registered: 2014-11-18
Posts: 40

thirdlight file ref is null

Hi,

When I upload file through API and tries to receive file ref via Upload.GetUploadResult() method
sometime file ref is null due to failure not sure why this happens, although file is very small size. Its not always- but only sometimes.

this is becoming a big issue as we need to fix this asap, may I know why this happens ? although next time the same file will be uploaded successfully.


Upload.GetUploadResult()

Input

{"action":"Upload.GetUploadResult","apiVersion":"1.0","inParams":{"uploadKey":"xxxxx"}}

Output (When received correctly)

{"result":{"api":"OK","action":"OK","timings":{"initTime":53,"setupTime":3,"methodTime":10,"totalTime":66}},"outParams":{"succeeded":{"file":"123456"},"failed":[],"error":false,"count":1}}


Output (When received NULL)

{"result":{"api":"OK","action":"OK","timings":{"initTime":53,"setupTime":3,"methodTime":10,"totalTime":66}},"outParams":{"succeeded":[],"failed":["file"],"error":false,"count":0}}


Thanks
Satish

Last edited by satishd (2015-07-07 10:56:45)

Offline

#2 2015-07-16 13:52:59

dominic
Third Light Staff
Registered: 2013-06-06
Posts: 96

Re: thirdlight file ref is null

Hi Satish,

I'm not sure why this would be - are you able to provide any detail about the circumstances under which it does occur? Things like the number of parallel requests, or other operations taking place would be a good place to start. Alternatively, can you reproduce using one of the in-IMS upload mechanisms (the browser uploader is the most similar)?

Dominic

Offline

#3 2015-07-24 09:53:40

satishd
Member
Registered: 2014-11-18
Posts: 40

Re: thirdlight file ref is null

Hi Dominic,

There are no parallel requests, its just one batch uploads file one after the other- This morning I had failure around 8:25:09  AM, would you
be able check log files from your end what had happened at this point of time. I can't reproduce this error when I want or through IMS upload, it just happens sometime. Same file gets uploaded next time when batch runs.

Thanks
Satish

Offline

#4 2015-07-24 11:45:47

james
Third Light Staff
Registered: 2013-07-04
Posts: 6

Re: thirdlight file ref is null

Hello Satish,

In order to track this problem down, could you provide us with some additional details please?

1) We had a look in our logs around 8:25am (GMT) but did not find anything. Could you confirm that this was the correct time?
2) Could you provide us with the file name and size of the file that failed to upload properly?
3) Next time that you perform an upload that fails, could you give us back the exact URL to dofileupload.tlkx that was used, and the response from it? The URL will look something like "dofileupload.tlxr?task=gqvqgVPU3IvgyvZgjQoNY&t=ajax", and the response something like "{error:"string"}"

Thus far we have not seen any particularly odd behaviour but with these details we'll be much better equipped to find any potential issue.

Thanks,
James

Offline

#5 2015-07-24 15:25:26

satishd
Member
Registered: 2014-11-18
Posts: 40

Re: thirdlight file ref is null

Hi James,

The file we are uploading is 'PHOTO.ING.ITRI.S15.23JUL15.jpg', The failure happened yesterday 08:25:09 not today...sorry I overlooked the date.
and the response from API is as below, although no error, but if it had succeeded then we would have got the file reference within the json response.

the actual response we got y'day is as below

{"result":{"api":"OK","action":"OK","timings":{"initTime":53,"setupTime":3,"methodTime":10,"totalTime":66}},"outParams":{"succeeded":[],"failed":["file"],"error":false,"count":0}}



Thanks
Satish

Last edited by satishd (2015-07-24 15:26:02)

Offline

#6 2015-07-24 18:11:50

james
Third Light Staff
Registered: 2013-07-04
Posts: 6

Re: thirdlight file ref is null

Hello Satish,

Thanks for the information!

We've spent some time looking into your issue but we haven't gotten to the bottom of it just yet. We have however noticed that the file you attempted to upload at 8:25 yesterday did in fact make it into your IMS, and so are looking into why you received an error response when the upload actually seems to have been successful.

As something to try, could you add "blocking: false" as an option when you call "Upload.CreateUpload". Also, it would be really useful if you could provide us the full piece of code that you used in order to perform the uploads in case we might find something on that side of things. In particular we're interested in what IMS API calls you make, in what order, and what data you pass to them.

Thanks!
James

Offline

#7 2015-07-27 09:47:28

satishd
Member
Registered: 2014-11-18
Posts: 40

Re: thirdlight file ref is null

Hi James,

After I successfully login , I use the following sequence of API calls to upload and get file progress of upload and file ref.

1. Upload.CreateUpload()
2. Construct file stream and upload
URL https://oursite.thirdlight.com/dofileupload.tlxr?task=LBMXLfHaEVMLB7ILzNEFtXXX"

3. Upload.StartUpload()
4. Upload.GetUploadProgress()
5. Upload.GetUploadResult()         ;to get the file ref.


In step 5, I try to find the file ref of the file being uploaded so that I can update that value in our db, in Step5 sometime we get error once in a while
irrespective of file size, please let me know if you require any further details on this.


Thanks
Satish

Last edited by satishd (2015-07-27 09:48:40)

Offline

#8 2015-07-27 11:24:39

james
Third Light Staff
Registered: 2013-07-04
Posts: 6

Re: thirdlight file ref is null

Hello,

Thanks for that. The one other thing that we'd find useful is the parameters that you passed when making a couple of the calls, specifically:

- what parameters you pass to CreateUpload
- do you set blocking to true when calling StartUpload

We'll need to look into this further, and so being sure that we can reproduce your scenario will be very helpful.

In the meantime, perhaps it would be useful for you to know the steps that our own HTML5 uploader takes:

1. Upload.CreateUpload( synchronous: true, blocking: false )
2. post data to dofileupload.tlxr
3. poll Upload.getUploadResult occasionally to determine what's finished
4. when everything has come back as succeeded (or failed), we call Upload.finaliseUpload to tidy up (only necessary with synchronous non blocking uploads).

This may not be suitable for you, but I thought it would be worth a mention just in case it gives you something else to try.

Thanks,
James

Last edited by james (2015-07-27 11:25:09)

Offline

#9 2015-07-27 12:02:41

satishd
Member
Registered: 2014-11-18
Posts: 40

Re: thirdlight file ref is null

Thanks James,

Please note that I don't pass blocking parameter in startupload, here are the input request which I send it to API

1.     CreateUpload()
json = "{"action":"Upload.CreateUpload"," +
                                   ""apiVersion":"1.0"," +
                                   ""inParams":{"params":{"destination":"" + parentId + ""," +
                                   ""synchronous":false," +
                                   ""allowotheruserupload":true," +
                                   ""editablemetadata":{"caption":"OPTIONAL","keywords":"OPTIONAL","source":"OPTIONAL"}," +
                                   ""lifetime":3600}" +
                                   "}," +
                                   ""sessionId":"" + sessionId + """ +
                                    "}";

2. StartUpload()

json = "{"action":"Upload.StartUpload"," +
                               ""apiVersion":"1.0"," +
                               ""sessionId":"" + sessionId + ""," +
                               ""inParams":{"uploadKey":"" + uploadKey + """ +
                               "}" +
                                "}";


Thanks Satish

Last edited by satishd (2015-07-27 12:03:08)

Offline

#10 2015-07-27 12:07:35

james
Third Light Staff
Registered: 2013-07-04
Posts: 6

Re: thirdlight file ref is null

Thankyou, that'll give us enough to go on for now!
James

Offline

#11 2015-08-13 09:50:53

satishd
Member
Registered: 2014-11-18
Posts: 40

Re: thirdlight file ref is null

Hi James,

Any update on this issue please, Yesterday we had one more file failure around 12/08/2015 10:45:08
due to not being able to get fileref from thirdlight api.

Thanks
Satish

Offline

#12 2015-08-13 16:48:05

steve
Third Light Staff
Registered: 2013-06-06
Posts: 92

Re: thirdlight file ref is null

Hi Satish,

Despite trying to replicate your findings by uploading using the method that you describe, we have not seen any failures in our own tests. It is a little difficult to suggest where to look next but we have increased the level of log detail in your server to see if it will contain any extra information the next time the problem occurs.

Could you let us know the date and times when you next encounter the problem please as we will then check to see if the logs help to narrow things down.

Best Regards,
Steve

Offline

Board footer