FatalClientError - Cannot read properties of undefined (reading 'CUSTOM_INFRA_URL') using Remix
Hi, when I try to upload a file using UploadButton or UploadDropZone using Remix, the files are uploaded to uploadthing but I get the following error instead of the UploadComplete confirmation:
Something went wrong. Please report this to UploadThing.
at fatalClientError (useUploadThing.ts:37:3)
at useUploadThing.ts:92:47
TypeError: Cannot read properties of undefined (reading 'CUSTOM_INFRA_URL') at generateUploadThingURL (utils.ts:115:28) at pollForFileData (utils.ts:156:20) at client.ts:258:11 at async Promise.all (index 0) at async useUploadThing.ts:63:21 I have managed to solve this when I comment out the following lines in the generateUploadThingURL function: function generateUploadThingURL(path) { let host = "https://uploadthing.com"; // if (typeof process !== "undefined") { // host = process.env.CUSTOM_INFRA_URL ?? host; // } else { // host = import.meta.env.CUSTOM_INFRA_URL ?? host; // } return
TypeError: Cannot read properties of undefined (reading 'CUSTOM_INFRA_URL') at generateUploadThingURL (utils.ts:115:28) at pollForFileData (utils.ts:156:20) at client.ts:258:11 at async Promise.all (index 0) at async useUploadThing.ts:63:21 I have managed to solve this when I comment out the following lines in the generateUploadThingURL function: function generateUploadThingURL(path) { let host = "https://uploadthing.com"; // if (typeof process !== "undefined") { // host = process.env.CUSTOM_INFRA_URL ?? host; // } else { // host = import.meta.env.CUSTOM_INFRA_URL ?? host; // } return
${host}${path}
;
}
I suppose there is another way to fix this without modifying the node_modules files. Would it be possible to tell me what I am doing wrong?0 Replies