sudhanshug
sudhanshug
Explore posts from servers
TTCTheo's Typesafe Cult
Created by sudhanshug on 11/4/2024 in #questions
[Expo + UT] Error when importing @uploadthing/expo
No description
38 replies
TTCTheo's Typesafe Cult
Created by sudhanshug on 10/21/2024 in #questions
[Rails + UT] How to use UploadThing outside of JS ecosystem, using Rest API?
Hey, I am building file upload functionality for my Expo+Rails app. I was hoping to use UploadThing for it's robust FE library and the managed s3 experience. Firstly, the docs aren't friendly for non-JS folks, please look into that - a lot of contradicting/variety of information. I am calling the /v6/prepareUpload endpoint in my /api/uploadthing api controller but it is not returning presigned urls as one would hope reading the REST api docs. Here is the shape of the output:
export interface PrepareUploadResposne {
url: string;
fields: Fields;
key: string;
contentDisposition: string;
fileUrl: string;
appUrl: string;
pollingJwt: string;
pollingUrl: string;
fileName: string;
fileType: string;
customId: string;
}
export interface Fields {
acl: string;
Content-Type: string;
Content-Disposition: string;
bucket: string;
X-Amz-Algorithm: string;
X-Amz-Credential: string;
X-Amz-Date: string;
key: string;
Policy: string;
X-Amz-Signature: string;
}
export interface PrepareUploadResposne {
url: string;
fields: Fields;
key: string;
contentDisposition: string;
fileUrl: string;
appUrl: string;
pollingJwt: string;
pollingUrl: string;
fileName: string;
fileType: string;
customId: string;
}
export interface Fields {
acl: string;
Content-Type: string;
Content-Disposition: string;
bucket: string;
X-Amz-Algorithm: string;
X-Amz-Credential: string;
X-Amz-Date: string;
key: string;
Policy: string;
X-Amz-Signature: string;
}
I am using expo in the FE, here is the code that calls my /api/uploadthing api:
const rnHelper = generateReactNativeHelpers<{
direct_upload: Uploader<
Omit<AnyParams, "_input"> & {
_input: { checksums: string[] };
}
>;
}>({
url: apiClient.baseUrl + "/api/uploadthing",
});

const resp = await rnHelper.createUpload("direct_upload", {
files,
input: {
checksums: await Promise.all(
expoFiles.map(async (f) => computeMD5Checksum(await readFileData(f))),
),
},
headers: {
Authorization: `Bearer ${await getToken()}`,
},
});
const rnHelper = generateReactNativeHelpers<{
direct_upload: Uploader<
Omit<AnyParams, "_input"> & {
_input: { checksums: string[] };
}
>;
}>({
url: apiClient.baseUrl + "/api/uploadthing",
});

const resp = await rnHelper.createUpload("direct_upload", {
files,
input: {
checksums: await Promise.all(
expoFiles.map(async (f) => computeMD5Checksum(await readFileData(f))),
),
},
headers: {
Authorization: `Bearer ${await getToken()}`,
},
});
My understanding is that the response of prepareUpload should be the result of my uploadthing controller and the FE library will read it and take care of the direct upload. Please advise what can be done here.
132 replies
KKinde
Created by sudhanshug on 4/22/2024 in #💻┃support
Does the expo/RN SDK work with react native web?
Hi, I am starting a new project and wanted to know if the Expo SDK supports React Native Web?
2 replies
KKinde
Created by sudhanshug on 1/22/2024 in #💻┃support
Can the PKCE access token be used to authenticate/authorize requests
Hi, I am currently using clerk with a chrome extension. I want to switch to a service that supports Oauth PKCE flow. Clerk has it but the access token retrieved from this flow can not be used to authenticate requests. Does Kinde support PKCE fully? Can the nextjs middleware automatically verify/permit requests with the PKCE access token?
53 replies
DTDrizzle Team
Created by sudhanshug on 9/13/2023 in #help
why do snapshots not have the same name as the migrations?
No description
15 replies