Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERR_HTTP_INVALID_HEADER_VALUE in Version 2.3.3 #897

Open
JD2k opened this issue Feb 5, 2025 · 0 comments
Open

ERR_HTTP_INVALID_HEADER_VALUE in Version 2.3.3 #897

JD2k opened this issue Feb 5, 2025 · 0 comments

Comments

@JD2k
Copy link

JD2k commented Feb 5, 2025

Hello,

on uploading a file in version 2.3.3. iam getting this error:

W20250205-17:19:45.483(1)? (STDERR) (node:69126) UnhandledPromiseRejectionWarning: TypeError [ERR_HTTP_INVALID_HEADER_VALUE] [ERR_HTTP_INVALID_HEADER_VALUE]: Invalid value "undefined" for header "Access-Control-Allow-Origin"
W20250205-17:19:45.484(1)? (STDERR)     at ServerResponse.setHeader (_http_outgoing.js:564:3)
W20250205-17:19:45.484(1)? (STDERR)     at packages/ostrio:files/server.js:532:20
W20250205-17:19:45.484(1)? (STDERR)     at /Users/Joerg/.meteor/packages/promise/.0.12.2.1q0ypka.2cv2++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/meteor-promise/fiber_pool.js:43:40

If i rollback to version 2.2.1 everything works fine. Can you help me out here?

Ostrio related code is not changed in both cases:

export const TenantFiles = new FilesCollection({
    collectionName: "TenantFiles",
    storagePath: tenantFilePath,
    allowClientCode: true, // Disallow remove files from Client
});

export const createUploadPromise = ({fileId, data, onProgress, callBackFunc}:
                                        {
                                            fileId?: string,
                                            data: File,
                                            onProgress?: (progress: number, file: File) => void,
                                            callBackFunc?: (upload: any, fileObj: any) => void
                                        }
) => {
    return new Promise((resolve, reject) => {
        const upload: FileUpload = TenantFiles.insert({
            fileId: fileId ?? undefined,
            file: data,
            chunkSize: "dynamic",
        }, false);
        upload.on("end", function (error: Error, fileObj: File) {
            //console.log('Upload end: ')
            if (error) {
                console.error(error)
                reject(typeof error === "object" ? {...error, ...fileObj} : error);
            } else {
                if (callBackFunc) callBackFunc(upload, fileObj);
                resolve(upload, fileObj);
            }
        });
        upload.on("progress", function (progress: number, fileObj: File) {
            if (onProgress) onProgress(progress, fileObj);
        });
        upload.on("error", function (error: Error, _fileObj: File) {
            console.error("Error during upload: " + error);
            reject(error);
        })
        upload.start();
    });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant