Theo's Typesafe CultTTC
Theo's Typesafe Cult13mo ago
56 replies
bed

UploadThing invalid secret error, invalid server config

Hi I'm using the UTapi and it stopped working with the new sdk API keys not sure what's going on

this project uses Astro

any help is appreciated thanks!

src/server/uploadthing.ts
import { UTApi } from "uploadthing/server";

export const utapi = new UTApi();


api route
import { utapi } from "src/server/uploadthing.ts";

 const result = await utapi.uploadFiles(files);


Error msg
 e: Error: Invalid upload result: {"data":null,"error":{"message":"Invalid token. A token is a base64 encoded JSON object matching { apiKey: string, appId: string, regions: string[] }.","_tag":"UploadThingError","name":"UploadThingError","code":"INVALID_SERVER_CONFIG","cause":{"_op":"InvalidData","path":["token"],"message":"((Uint8ArrayFromBase64 <-> (Uint8ArrayFromSelf <-> string)) <-> ((JsonString <-> unknown) <-> (Struct (Encoded side) <-> Struct (Type side))))\n└─ Encoded side transformation failure\n   └─ (Uint8ArrayFromBase64 <-> (Uint8ArrayFromSelf <-> string))\n      └─ Encoded side transformation failure\n         └─ Uint8ArrayFromBase64\n            └─ Transformation process failure\n               └─ Invalid character _"}}}
    at eval (/Users/malik/Desktop/Programs/naturual-language-file-conversion/file-converter-ai/src/pages/api/convert.ts:224:21)
    at Array.map (<anonymous>)
    at Worker.eval (/Users/malik/Desktop/Programs/naturual-language-file-conversion/file-converter-ai/src/pages/api/convert.ts:222:47)
Was this page helpful?