Skip to content

unmap_chunk(): invalid pointer error in nodejs >= v21.7.0 #139

@TarunCore

Description

@TarunCore

I tried to run the following code in NodeJS version >=v21.7.0

It gives the error:
unmap_chunk(): invalid pointer (Related to cpp bindings)

import { Bucket, Cluster, connect } from 'couchbase'
async function main() {
  const cluster: Cluster = await connect(
    'couchbases://cb.xx.cloud.couchbase.com',
    {
      username: 'user',
      password: 'pass',
    })

  const bucket: Bucket = cluster.bucket('mybucket')

  const collectionManager = bucket.collections();
  // This line of code is triggering the error
  collectionManager.createCollection("col2", "scope2", {
    maxExpiry: 5000
  })
}
main()

But in NodeJS version <= v21.6.2 there is no error and works fine.

Output:

Image

I actually ran into this issue while creating project by https://ottomanjs.com/

npx ottoman-cli generate
  • There is no warning about NodeJS version requirement which led to failure while running the project created by ottoman-cli
  • Then I directly tried running sdk https://github.com/couchbase/couchnode and found this issue with couchnode
  • This happens in Ubuntu as far as I tested, and not in Windows
  • lib/collectionmanager.ts is updated with cpp bindings in version v4.2.8 from v4.2.7. This might be the cause as v4.2.7 doesn't have this issue

System Info:
Ubuntu 24.04.2 LTS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions