Start a new topic

Image upload not working in SDK V3.4.0

Hi Guys


Not sure what is happening here. I upgraded to v3.4.0 and I can no longer upload images. The image appears to upload without errors but It can't be retrieved. 


I get this message when trying to retrieve:

GET http://storage.googleapis.com/de46caf24671493fb0b8ec71347ecdca/7a6e3915-978f-4fd1-afa1-54011e1de5a1/1486889535566-1136178403.jpg 404 (Not Found)


If I try to open the file via console I get a web page saying this:

This XML file does not appear to have any style information associated with it. The document tree is shown below.

 

<Error>

<Code>NoSuchKey</Code>

<Message>The specified key does not exist.</Message>

</Error>


I reverted back to V3.3.5 and all my images upload as intended again and I can retrieve them.


Has something changed that I need to accommodate for? I checked out the change notes and didn't see anything. 


The code      

var imageData ={ _acl:$Global.active_user_file_acl,
					filename: saveImageObj.imageName,
					mimeType: blob.type,
					size: blob.size,
					public: true,
					entity_id:saveImageObj.entityId,
					role:saveImageObj.role,
					metadata:saveImageObj.metadata
				};

				var promise = new RSVP.Promise(function(fulfill, reject) {
				var uploadedImage = Kinvey.Files.upload(blob, imageData)
					fulfill(uploadedImage);
					return uploadedImage;
				});
				promise.then(function onSuccess(uploadedImage) {
					var params = saveImageObj.postProcess.params
					var func = saveImageObj.postProcess.function 
						func(params,blob,uploadedImage) // post upload function call

				}).catch(function onError(error) {
					console.error(error)
					var params = saveImageObj.postProcess.params
					var func = saveImageObj.postProcess.function
						func(params,blob,error) // post error function call
			});

      Cheers



Hi Phil,


The Engineering team is planning to roll out a fix this week. I will keep you posted as it happens.


Thank you for your patience.



Regards,

Wani

Kinvey Support

Phil,

So just wanted to confirm that you are able to upload images with ver3.4.0 but unable to download it? Is it the same user account you are using for both?

Thanks,
Pranav
Kinvey

 

Hey Wani, I am experiencing the same issue regarding file uploads not working in version 3.4.0. Have you found any additional information regarding this issue?

Here is my file upload code that had been working fine for the past year until I performed the kinvey update. The upload returns successfully but if I click on the file in the Kinvey Dashboard/Files it displays the following error:


<Error>

 

<Code>NoSuchKey</Code>

<Message>The specified key does not exist.</Message>

</Error>


var metadata ={
_filename: file.name,
mimeType: file.type,
size: file.size,
public: true
};

$kinvey.Files.upload(file, metadata).then(function (_fileData) {
console.log("$upload: " + JSON.stringify(_fileData));
dfd.resolve(_fileData._id);
}, function(error){
dfd.reject(error);
alert("Error uploading the file: " + error.description);
});



Hi Pranav


Sorry I should be clearer. The issue is images do not upload properly. Retrieving them is an issue because there appears to be metadata but the file is corrupt some how. Even when I try to open directly via the Kinvey console I just get a web page that shows the second message. 


So:

1. Upload image using Kinvey.Files.upload()

2. Does not return error and file appears in file collection

3. Try to display image using _downloadURL and get "GET" error message

4. Try to view image directly via Kinvey Console and get the second message. 


The file does not appear to upload properly but does not return any errors. 


Cheers

Hello Everyone,


We are pleased to inform you that the latest JS SDK v3.4.1 release is available for download in our Kinvey DevCenter located at the following URL.


http://devcenter.kinvey.com


You can select the appropriate SDK for your needs from in the DevCenter using the dropdown menu in the upper right hand corner of the page.


This release fixes the problem described in this post regarding the problems uploading files to the GCP file store. 


Please let us know if you have any questions.


Regards,


Billy Gee

Kinvey Support

Pranav,


Has anyone confirmed that this issue exists in version 3.4?


Thanks

Mike

I have a file upload feature. Can confirm it appears to be for all files not just images. 


Cheers

Phil

I am having the same issue now. I have uploaded a file 1.jpg and I am trying to access it in the browser. I am getting response as 

<?xml version='1.0' encoding='UTF-8'?><Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message></Error>


image


What went wrong? I was able to access the file couple of days back.

Hi Phil,


Can you update the code as shown in the documentation (http://devcenter.kinvey.com/html5/guides/files#Upload), remove RSVP.Promise code and try again?


Also, are you suppling an _id value in metadata object?

Hey Wani!!!


Removed RSVP Promise and tested (sorry I thought I read we were meant to impliment our own promise library with V3, my bad)

V3.3.5 = working

V3.4.0 = issue remains


No I am not supplying a _id. I allow Kinvey to assign a unique _id. I have no value in generating my own of files, just adds code. 


Here is the code


 

var imageData ={ //build file metadata
              _acl:$Global.active_user_file_acl, 
		filename: saveImageObj.imageName,
		mimeType: blob.type,
		size: blob.size,
		public: true,
		entity_id:saveImageObj.entityId,
		role:saveImageObj.role,
		metadata:saveImageObj.metadata
		};
		// save to kinvey
		var promise = Kinvey.Files.upload(blob, imageData)
		promise.then(function onSuccess(uploadedImage) {
			// post image proccessing
		}).catch(function onError(error) {
			//post error handling
		});

 Cheers

Login or Signup to post a comment