Gitlab API - import project

Currently trying to import an exported gitlab project into another gitlab instance. I´m reciving an Internal Server error with no further information.

From what I can read from the docs i feel that i do the request correctly..

After requesting the file (Export function/ I´m writing it to the filesystem):

groupExport: async (gitlabInstance, groupId) => {
        if (!groupId || groupId === '') {
            throw new Error('groupId is needed');
        }

        let API_RESOURCE = `groups/${groupId}/export`;

        try {
            let { body } = await gitlabInstance.post(API_RESOURCE);
            console.log(body);

            let fileBuffer = await utilsHttp
                .overrideGotDefaultsToBuffer(gitlabInstance)
                .get(API_RESOURCE + '/download')
                .buffer();
            console.log(fileBuffer);

            return fileBuffer;
        } catch (error) {
            console.error(error);
            return null;
        }
    }

This is how I write the file to the filesystem:

async function writeBufferToFile(buffer, filePath) {
    filePath = filePath || '../tmp/exported-group.tar.gz';
    const fileOutPath = path.join(__dirname, filePath);

    try {
        await fsPromise.writeFile(fileOutPath, buffer);
        console.log('WROTE FILE');
        return true;
    } catch (error) {
        console.log(error);
        throw new Error(error);
    }
}

And then trying to import in to gitlab:

groupImport: async (gitlabInstance, filePath) => {
        const API_RESOURCE = `groups/import`;
        const form = new FormData();

        form.append('name', 'test-import');
        form.append('path', 'test-import');
        form.append('file', `${fs.createReadStream(filePath)}`);
        console.log(form);

        try {
            gitlabInstance.defaults.options = gitlabInstance.mergeOptions(
                gitlabInstance.defaults.options,
                {
                    headers: { 'Content-Type': 'multipart/form-data' },
                },
            );
            let res = await gitlabInstance.post(API_RESOURCE, {
                body: form,
            });
            console.log(res);
            return true;
        } catch (error) {
            console.error(error);
            return null;
        }
    }

Result: HTTPError: Response code 500 (Internal Server Error)

The docs only provide an example that is using CURL. Currently don't know what is wrong with my request. Find the docs here

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum