Search code examples
autodesk-forgeautodeskautodesk-model-derivative

Receiving 408 request timeout when we try to put an object to a Forge bucket


We are trying to upload a 'bigger' model to a forge bucket via the model derivative API. This model has a file size of 956MB and the extension .nwd

const uploadPromise = http(uploadUrl(socketId), {
    method: 'PUT',
    data: Body,
    headers: {
        'Content-Type': 'application/octet-stream',
        Authorization: `Bearer ${Forge.urns[socketId].autoDeskToken}`,
    },
    maxContentLength: 1024 * 1024 * 1024,
    timeout: 600000,
})

{ Error: Request failed with status code 408
  at createError (/nodejs/node_modules/axios/lib/core/createError.js:16:15)
  at settle (/nodejs/node_modules/axios/lib/core/settle.js:18:12)
  at IncomingMessage.handleStreamEnd (/nodejs/node_modules/axios/lib/adapters/http.js:202:11)
  at IncomingMessage.emit (events.js:203:15)
  at IncomingMessage.EventEmitter.emit (domain.js:448:20)
  at endReadableNT (_stream_readable.js:1145:12)
  at process._tickCallback (internal/process/next_tick.js:63:19)

The url seems to be correct: https://developer.api.autodesk.com/oss/v2/buckets/-BUCKETNAME-/objects/-filename-.nwd

What could be the reason of this error?

This is a problem a customer is experiencing.

kind regards, Thomas


Solution

  • That's interesting, the error code 408 is not listed in the documentation of the endpoint: https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectName-PUT. The error code is most likely coming from some middle-layer (Apigee), and not from the Forge servers directly.

    However, to upload a file this big, I'd strongly suggest using the "resumable upload" feature that's available in the Data Management service. You can find an example of how the resumable upload works in my TypeScript code here: https://github.com/petrbroz/vscode-forge-tools/blob/develop/src/commands/data-management.ts#L230-L272.