Skip to content

Collection#documentExists return JSON Parse error: Unexpected EOF #821

@shaynlink

Description

@shaynlink

When I use database.collection('medias').documentExists('medias/123'), actually return a JSON Parse error: Unexpected EOF error.

Bun: 1.2.2
arangoJS: 9.2.0 and 10.1.1
Arango: 3.7.10 Community Edition (I can't change it)

Code:

const database = await ArangoService.instance();
const collection = database.collection('medias');
await collection.documentExists('medias/123');

output:

Response (0 KB) {
  ok: true,
  url: "http://xxx:8529/_db/xxx/_api/document/medias/123",
  status: 200,
  statusText: "OK",
  headers: Headers {
    "x-content-type-options": "nosniff",
    "connection": "Keep-Alive",
    "content-type": "application/json; charset=utf-8",
    "content-length": "451",
    "server": "ArangoDB",
  },
  redirected: false,
  bodyUsed: false,
  Blob (0 KB)
}

690 |             headers.set("x-arango-trx-id", this._transactionId);
691 |         }
692 |         if (allowDirtyRead) {
693 |             headers.set("x-arango-allow-dirty-read", "true");
694 |         }
695 |         return new Promise((resolve, reject) => {
      ^
SyntaxError: JSON Parse error: Unexpected EOF
      at <parse> ()
      at parse (unknown:1:1)
      at processTicksAndRejections (native:7:39)
      at /xxx/node_modules/arangojs/esm/connection.js:695:20
      at request (/xxx/node_modules/arangojs/esm/connection.js:661:19)
      at request (/xxx/node_modules/arangojs/esm/databases.js:233:16)
      at /xxx/node_modules/arangojs/esm/collections.js:308:40
      at documentExists (/xxx/node_modules/arangojs/esm/collections.js:300:31)
      at /xxx/repository/MediaRepository.ts:14:42
      at processTicksAndRejections (native:7:39)

Metadata

Metadata

Labels

BugA code defect that needs to be fixed.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions