Ken Ngo - Hi team, I got error every time cal...
Hi team,
I got error every time calling importMetadataTML using the Typescript SDK
Context:
endpoint: MetadataApi.importMetadataTML
number of objects: 15 (tables)
{"level":30,"level_name":"info","timestamp":"2025-05-27T03:44:17.900Z","process_id":1516,"correlation_id":"","tenant_identifier":"","app":{"app_version":"1","service_name":"Analytics Console","service_area":"","service_type":"NestJS Server","team":"analytics","app_area":"","specific_app_area":"","port":3000},"image":{"environment":"development","port":3000,"base_image":"node:22-alpine","base_image_version":"22.15.0","framework":"NestJS","framework_version":"11.0.20","language":"typescript","language_version":"4.9"},"security":{"user":"","user_id":"","user_masq":"","user_masq_id":""},"message":"TableService.create: started to import 15 tables"}
ApiException [Error]: HTTP-Code: 504
Message: Unknown API Status Code!
Body: "<html>\r\n<head><title>504 Gateway Time-out</title></head>\r\n<body>\r\n<center><h1>504 Gateway Time-out</h1></center>\r\n</body>\r\n</html>\r\n"
Headers: {"connection":"keep-alive","content-length":"132","content-type":"text/html","date":"Tue, 27 May 2025 03:49:18 GMT"}
at MetadataApiResponseProcessor.<anonymous> (/app/node_modules/@thoughtspot/rest-api-sdk/dist/index.cjs:16981:13)
at Generator.next (<anonymous>)
at fulfilled (/app/node_modules/@thoughtspot/rest-api-sdk/dist/index.cjs:23:24)
at processTicksAndRejections (node:internal/process/task_queues:105:5) {
code: 504,
body: '<html>\r\n' +
'<head><title>504 Gateway Time-out</title></head>\r\n' +
'<body>\r\n' +
'<center><h1>504 Gateway Time-out</h1></center>\r\n' +
'</body>\r\n' +
'</html>\r\n',
headers: {
connection: 'keep-alive',
'content-length': '132',
'content-type': 'text/html',
date: 'Tue, 27 May 2025 03:49:18 GMT'
}
}
2 Replies
Hi @Ken Ngo ,
Could you please confirm how long it took for the error message to appear when using the TypeScript SDK?
@Justin
Could you also check and confirm whether there is a default API timeout configured in the TypeScript SDK?
Just as an FYI:
By default, all ThoughtSpot clusters have a 5-minute timeout for API calls.
š Recommended Action:
Instead of using tsRestApiClient.importMetadataTML (which executes synchronously), we recommend switching to tsRestApiClient.importMetadataTMLAsync. This ensures that the import is performed asynchronously and is more resilient to longer operations.
š Reference:
https://developers.thoughtspot.com/docs/tml#_import_tml_objects_asynchronously
Let me know once confirmed.
TML
The TML API endpoints allow you to export and import TML files
I created a support ticket to increase API timeout: https://community.thoughtspot.com/customers/s/case/500Uk00000a7TGo/adjust-cluster-api-timeout