Vilatoro
Vilatoro
TTCTheo's Typesafe Cult
Created by Vilatoro on 4/11/2024 in #questions
UTApi - server SDK uploadFilesFromUrl module error
I am getting a weird bug when uploading images using the utapi uploadFilesFromUrl. This is my server code for now, which is very similar to the one posted in the example. I am using bun, elysia, and the code is written in TypeScript.
const urlExample = "https://cdn2.hubspot.net/hubfs/53/image8-2.jpg";
utapi.uploadFilesFromUrl( urlExample);
const urlExample = "https://cdn2.hubspot.net/hubfs/53/image8-2.jpg";
utapi.uploadFilesFromUrl( urlExample);
error in the module:
1006 | ...options,
1007 | type: options?.type ?? (lookup(name) || undefined),
1008 | lastModified: options?.lastModified ?? Date.now()
1009 | };
1010 | super(parts, optionsWithDefaults);
1011 | this.name = name;
^
TypeError: Attempted to assign to readonly property.
at new UTFile (/mypath/node_modules/uploadthing/server/index.js:1011:9)
at /mypath/node_modules/uploadthing/server/index.js:1238:20
1006 | ...options,
1007 | type: options?.type ?? (lookup(name) || undefined),
1008 | lastModified: options?.lastModified ?? Date.now()
1009 | };
1010 | super(parts, optionsWithDefaults);
1011 | this.name = name;
^
TypeError: Attempted to assign to readonly property.
at new UTFile (/mypath/node_modules/uploadthing/server/index.js:1011:9)
at /mypath/node_modules/uploadthing/server/index.js:1238:20
2 replies
TTCTheo's Typesafe Cult
Created by Vilatoro on 3/26/2024 in #questions
uploadthing in a server side environment
No description
9 replies
TTCTheo's Typesafe Cult
Created by Vilatoro on 3/14/2024 in #questions
How to use upload thing with only OpenAPI Specs?
I have tryed using upload thing with my Elysia/react app, with uploadthing but I was not successful to set it up. So I decided to use the OpenAPI spec by it self instead. This is my current fetch request, but I do not know why I keep getting an error: ''' fetch('https://uploadthing.com/api/prepareUpload', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Uploadthing-Api-Key': Bun.env.MySecret, 'X-Uploadthing-Version': '6.4.0' }, body: JSON.stringify({ callbackUrl: 'http://localhost:3000/upload-image2', callbackSlug: 'upload-image2', files: [{ name: 'userID.'+type, size: 1, }], "routeConfig": [ image: { maxFileSize: "4MB",maxFileCount: 1, } ] , metadata: null }) }) ''' ''' error: { "error": "Invalid request input", "data": [ { "code": "invalid_type", "expected": "object", "received": "string", "path": [], "message": "Expected object, received string" } ] } '''
5 replies