From 0d87652df8ad13748003fc6baa76cbb6a04760a3 Mon Sep 17 00:00:00 2001 From: Jacob Marble Date: Tue, 13 Aug 2024 13:38:23 -0700 Subject: [PATCH] fix: handle 201 response from write endpoint InfluxDB v3 returns 201 for partial write errors. --- CHANGELOG.md | 4 ++++ packages/core/src/impl/WriteApiImpl.ts | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2caaf93f..ff456c8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## 1.35.0 [unreleased] +### Bug Fixes + +1. [#1044](https://github.com/influxdata/influxdb-client-js/pull/1044): Allow 201 status code in a write response. + ## 1.34.0 [2024-07-26] ### Breaking Changes diff --git a/packages/core/src/impl/WriteApiImpl.ts b/packages/core/src/impl/WriteApiImpl.ts index 3dc4b33f..4eca13c7 100644 --- a/packages/core/src/impl/WriteApiImpl.ts +++ b/packages/core/src/impl/WriteApiImpl.ts @@ -236,8 +236,9 @@ export default class WriteApiImpl implements WriteApi { reject(error) }, complete(): void { + // InfluxDB v3 returns 201 for partial success // older implementations of transport do not report status code - if (responseStatusCode == 204 || responseStatusCode == undefined) { + if (responseStatusCode == 204 || responseStatusCode == 201 || responseStatusCode == undefined) { self.writeOptions.writeSuccess.call(self, lines) self.retryStrategy.success() resolve()