I am trying to translate a file ifc to svf. I'm making the upload in multi parts and seems to be correct. This is the code Im using to translate
public async convertFileToSvfFormat(forgeApiAccessToken: string, urn: string): Promise<any> {
const forgeFileConversionResponse = await firstValueFrom(
this.forgeHttpService.post(
`modelderivative/v2/designdata/job`,
JSON.stringify({
input: {
urn,
},
output: {
formats: [
{
type: this.DEFAULT_FORGE_FORMAT_TYPE, // 'svf'
views: this.DEFAULT_FORGE_FORMAT_VIEWS, // ["2d", "3d"]
},
],
},
}),
{
headers: {
"Authorization": `Bearer ${forgeApiAccessToken}`,
"Content-Type": "application/json",
},
},
),
)
return forgeFileConversionResponse
}
But the manifest endpoint after a while throws this:
{
"urn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bnY5a2cyZnB5bTFsdDQ5MDkxdzdobXVsbzlha3RldXdfdHV0b3JpYWxfYnVja2V0L2MyMWE2MzcwZTMwNzJmM2IwZTA3OWE5MzRjYWM4YTZlLmlmYw",
"derivatives": [
{
"hasThumbnail": "false",
"name": "c21a6370e3072f3b0e079a934cac8a6e.ifc",
"progress": "complete",
"messages": [
{
"type": "error",
"message": "Unrecoverable exit code from extractor: -1073741829",
"code": "TranslationWorker-InternalFailure"
}
],
"outputType": "svf",
"status": "failed"
}
],
"hasThumbnail": "false",
"progress": "complete",
"type": "manifest",
"region": "US",
"version": "1.0",
"status": "failed"
}
Am I missing something? How can I know which is the error?
Thanks!
-edit
Here is the method in which Im uploading the files.
public async uploadFileToForgeBucket(forgeApiAccessToken: string, file: Express.Multer.File): Promise<void> {
// When de-hardcoding the Forge acocunt to assign accounts to each user, de-hardcode this value here
const bucketKey = this.getBucketKey(this.hardcodedForgeClientId)
const path = join(__dirname, "../../../../upload/") + file.filename
const parts = Math.floor(this.calculateFileChuncks(path))
const signedUrls = await this.getS3SignedUrl(forgeApiAccessToken, file.filename, parts)
parts > 1 && splitFileInChunks(path, parts)
console.log(`Number of parts: ${parts}`)
const timerId = setTimeout(async () => {
const fileName = parts > 1 ? `${file.filename}.sf-part${parts}` : file.filename
const exists = existsSync(`./upload/${fileName}`)
console.log(exists && "Last chunk exists and read...")
if (exists) {
console.log("Starting upload...")
for (let i = 0; i < signedUrls.urls.length; i++) {
const currentUrl = signedUrls.urls[i]
let part: string
if (parts > 9) {
part = (i + 1).toString().length === 1 ? `0${i + 1}` : (i + 1).toString()
} else {
part = (i + 1).toString()
}
const fileName = parts > 1 ? path + `.sf-part${part}` : path
const stream = readFileSync(fileName)
await firstValueFrom(
this.forgeHttpService.put(
currentUrl,
{ data: stream },
{
headers: {
"Content-Type": "application/octet-stream",
"Content-Length": stream.length,
// "Content-Range": `bytes 0-${stream.length}`,
"Content-Disposition": `${file.filename}.sf-part${part}`,
},
},
),
)
const percentage = ((i + 1) / parts) * 100
console.log(`Uploading file... ${percentage.toFixed(2)}%`)
}
console.log("Upload complete. Processing...")
console.log("Re-unifying file:", `${file.filename}`)
const result = await firstValueFrom(
this.forgeHttpService.post(
`https://developer.api.autodesk.com/oss/v2/buckets/${bucketKey}/objects/${file.filename}/signeds3upload`,
{
uploadKey: signedUrls.uploadKey,
},
{
headers: {
"Authorization": `Bearer ${forgeApiAccessToken}`,
"Content-Type": "application/json",
},
},
),
)
clearInterval(timerId)
console.log(result.data)
const toBase64 = stringToBase64(result.data.objectId)
console.log(toBase64)
const translation = await this.convertFileToSvfFormat(forgeApiAccessToken, toBase64)
console.log(translation)
// console.log(translation, "trans")
}
}, 2000)
The result for this is:
data: {
result: 'success',
urn: 'dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6eG02ZjIxbWUxMHNxbTc4NmlhY3c2cTV6bjUxeWdpZmhfdHV0b3JpYWxfYnVja2V0L3JhY19iYXNpY19zYW1wbGVfcHJvamVjdF92My5pZmM',
acceptedJobs: { output: [Object] }
}
After that I call the translation method. Which ends up failing with the error code I copied before.