Custom Uppy file metadata no longer returns in callback

This worked in Uppy v1.8. I upgraded to 2.1 to fix other bugs and it stopped.

Adding file metadata in Uppy Core.

		onBeforeFileAdded: (file, files) => {
			 file['meta']['pte_uid'] = pte_UUID();
			 file['meta']['pte_source'] = file.source;
			return true;
	     }

Seems to work above but fails below even with the proper metadata in file in Uppy Transloadit. Can someone help with updated syntax in and around “fields” below? Thanks!


			getAssemblyOptions (file) {
				return {
					params: {
 				    auth: { key: 'xxxxxx' },
						template_id: 'xxxxx'
 		  		},
					fields: {
						pte_uid: file.meta.pte_uid,
						pte_source: file.meta.pte_source,
						pte_uppy_instance_id: file.meta.pte_uppy_instance_id
					}
				}
			}

Anyway, by passing in my own uniqueId, I was able to let users leave before hearing back from Transloadit thereby letting my users do other things rather than wait for the reply.

If I could add per-file metadata that traveled along with the file from Uppy to Transloadit and back to me by callback, that would be great. Otherwise, I’ll wait for Transloadit to reply after uploads are done.

I believe in the recent version of Uppy, in order to use “fields”, you have to place it in “params”, so it would look something like this:
params: {
auth: { key: ‘xxxxxx’ },
template_id: ‘xxxxx’,
fields: {
pte_uid: file.meta.pte_uid,
pte_source: file.meta.pte_source,
pte_uppy_instance_id: file.meta.pte_uppy_instance_id
}
},

1 Like