How to use uploadthing using REST APIs?
I was able to create presigned URL using /v7/prepareUpload and then when i use
curl -X PUT --data "@filename" "presignedURL"
I am getting this error
{"statusCode":415,"code":"FST_ERR_CTP_INVALID_MEDIA_TYPE","error":"Unsupported Media Type","message":"Unsupported Media Type: application/x-www-form-urlencoded"}
and when i use
curl -X PUT -F "file=@filename" "presignedURL"
request is stalled for 1-2mins then i get this as a result
* Connection #0 to host sea1.ingest.uploadthing.com left intact
{"statusCode":400,"error":"Bad Request","message":"target: uploadthing.-.primary: vttablet: rpc error: code = AlreadyExists desc = Duplicate entry 't40i8m2t6y-legder' for key 'file.external_id_idx' (errno 1062) (sqlstate 23000) (CallerID: 0ybmpzdmg81y412szmx9): Sql: \"insert into file(id, created_at,
name,
path, filetype, filehash, external_id, file_key, metadata, callbackdata, size, download_url, acl, callback_url, callback_slug, callback_response, callback_error, app_id, api_key_id, bucket_id, marked_for_deletion, deleted_at, upload_failed, quarantined_at, quarantined_reason, quarantined_by, quarantine_user_liftable, unquarantined_at, unquarantined_by) values (:vtg1 /* VARCHAR */, default, :vtg2 /* VARCHAR */, default, :vtg3 /* VARCHAR */, default, :vtg4 /* VARCHAR */, :vtg5 /* VARCHAR */, :vtg6 /* VARCHAR */, default, :vtg7 /* INT64 */, default, :vtg8 /* VARCHAR */, :vtg9 /* VARCHAR */, :vtg10 /* VARCHAR */, default, default, :vtg11 /* VARCHAR */, :vtg12 /* VARCHAR */, :vtg13 /* INT64 */, default, default, default, default, default, default, default, default, default)\", BindVars: {REDACTED}"}

2 Replies