Back

Internal curl errors has occurred within the executor! Error Number: 52. Error Msg: Empty reply from

  • 0
  • Self Hosted
  • Functions
Abhishek
25 Sep, 2024, 14:18

I'm getting the following error very frequently now: Internal curl errors has occurred within the executor! Error Number: 52. Error Msg: Empty reply from server\nError Code: 500

The whole is in the try-and-catch block where in catch I'm returning json response with a 500 status code.

TL;DR
Developers are encountering an error with empty replies from the server when using the curl executor. The issue arises within the try-catch block. A potential solution could involve investigating the environment variables or checking for any issues within the curl requests.
Kenny
25 Sep, 2024, 15:28

Could you post your code, leave out anything not important to the question at hand

Abhishek
25 Sep, 2024, 15:55
TypeScript
export const errorRes = (
    res: any, error: any, message: string, code: number) => {
    error(message);
    return res.json(
        {success: false, error: message},
        code
    )
};

export default async ({req, res, log, error}: Context) => {
    let doc: string | null = null;
    let client;

    try {
        if (
            !process.env["APPWRITE_FUNCTION_API_ENDPOINT"] ||
            !process.env["APPWRITE_API_KEY"] ||
            !process.env["APPWRITE_FUNCTION_PROJECT_ID"]
        ) {
            return errorRes(res, error, 'ENV Variables missing.', 500);
        }

        /* --------------------- */
        // Do operations

        
        /* --------------------- */
        return res.json({
            success: true,
            file_id: uploadedFile.$id,
        });

    } catch (err: unknown) {
        if (err instanceof Error) {
            error(err.stack);
        }
        return errorRes(res, error, 'Something went wrong internally. Message: ' + err, 500);
    }

};
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more