autodesk-forgeautodesk-viewerautodesk-model-derivative

TranslationWorker-Internal Failure: Tr worker failed to unzip


I am working on loading a STEP model to an APS (Autodesk Platform Services) viewer. The STEP model is getting uploaded in the bucket and then I am trying to translate into SVF and getting TranslationWorker-Internal Failure: Tr worker failed to unzip. Please refer to the snapshot in which you can see I have used Visual Studio Code APS extention. Visual Studio Code APS extension snapshot for reference

On trying to translate the STEP model into SVF using the code, the translation job is getting failed. Below, you'll find the code snippet for reference. Furthermore, after uploading the STEP model to the APS S3 bucket, when the translation failed, I attempted to delete the derivative of that model from the Visual Studio Code extension. Surprisingly, upon retrying to translate it from the Visual Studio Code entension, it was successfully completed. This suggests that the model was uploaded successfully, but there was a problem specifically with the translation process.

Following the steps I am referring: https://aps.autodesk.com/en/docs/model-derivative/v2/tutorials/translate-to-obj/task2-upload_source_file_to_oss/ I obtained the objectId during Step 4: Finalize Upload. Subsequently, I performed the following steps:

//after getting objectId from the step 4, converting the objectId to base64encoded
const base64EncodedObjectId = window.btoa(objectId);
//making the code URL-safe base64 (no padding)
let base64EncodedObjectIdURLSafe = 
base64EncodedObjectId.replace(/\+/g, '-').replace(/\//g, '_');
const URN = base64EncodedObjectIdURLSafe.replace(/=+$/, '');

const startTranslationToSVF = async (URN, modelName) => {
const encodedToken = await getAutodeskBearerToken();
const importURL = `$https://developer.api.autodesk.com/modelderivative/v2/designdata/job`;
const headers = {
    Authorization: encodedToken,
};

const body = {
    input: {
        urn: `${URN}`,
        compressedUrn: true,
        rootFilename: `${modelName}`,
    },
    output: {
        destination: {
            region: "us",
        },
        formats: [
            {
                type: "svf",
                views: ["2d", "3d"],
            },
        ],
    },
};
return axios({
    method: "POST",
    url: importURL,
    headers: headers,
    data: body,
})
    .then((resp) => {
        return resp;
    })
    .catch((error) => {
        return onHandleError(error);
    });
};

const checkSVFTranslationStatus = async (URN) => {
const encodedToken = await getAutodeskBearerToken();
const importURL= `$https://developer.api.autodesk.com/modelderivative/v2/designdata/${URN}/manifest`;
const headers = {
    Authorization: encodedToken,
};
return axios({
    method: "GET",
    url: importURL,
    headers: headers,
})
    .then((resp) => {
        return resp;
    })
    .catch((error) => {
        return onHandleError(error);
    });
};

const expectedStatus = "complete";
let translationStatus = "incomplete";

//Translating the uploaded APS model to SVF
await startTranslationToSVF(URN, modelName);
while (translationStatus !== expectedStatus) {
const status = await ServiceHandler.checkSVFTranslationStatus(
    modelURN
);
if (status.data.progress === "complete") {
    translationStatus = "complete";
    console.log("translation completed");
    break;
}
await delay(2500);
}

Any help would be greatly appreciated!


Solution

  • I can see from your code that you are translating a zip file: compressedUrn: true + rootFilename
    enter image description here
    but the file is uploaded with the extension *.stp:
    enter image description here
    It's best practice to use the correct file extension - in the case of non-zip files it's essential, but I would stick to it with zip files as well. If you want to indicate what file is inside the zip you could just name it like this following your file's current name Assembly1.stp.zip

    If the file is in fact not a zip, then your translation code is wrong, and you just have to use this as input:

    input: {
      urn: `${URN}`
    },