Skip to content

ElasticSearch Support in Cloudflare Workers #6527

@keehun

Description

@keehun

What versions & operating system are you using?

  System:
    OS: Windows 11 10.0.26100
    CPU: (24) x64 AMD Ryzen 9 7900X 12-Core Processor
    Memory: 16.04 GB / 31.04 GB
  Binaries:
    Node: 22.13.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.22 - C:\Users\keehun\AppData\Roaming\npm\yarn.CMD
    npm: 11.4.2 - C:\Program Files\nodejs\npm.CMD
    pnpm: 10.13.1 - C:\Users\keehun\AppData\Local\pnpm\pnpm.EXE
    bun: 1.2.18 - C:\Users\keehun\.bun\bin\bun.EXE
  npmPackages:
    wrangler: ^4.80.0 => 4.80.0

Please provide a link to a minimal reproduction

https://github.com/keehun/es-portal

Describe the Bug

I really want to be able to use @elastic/elasticsearch from a Cloudflare Worker. It doesn't seem to be supported:

This is not specific to Windows even though I am on Windows. This happens on Mac as well.

For trusted Cloudflare employees, I would be happy to provide access to an elasticsearch instance and an example query to use.

Please provide any relevant error logs

[wrangler:info] POST /api/get 401 Unauthorized (4ms)
⎔ Reloading local server...
⎔ Local server updated and ready
past client {"id":"<ES DOC ID>","index":"<ES INDEX ID>"}
X [ERROR] ConnectionError: The options.ALPNProtocols option is not implemented

      at SniffingTransport._request
  (file:///frontend/es-portal-vercel/node_modules/@elastic/transport/src/Transport.ts:682:17)
      at null.<anonymous> (async
  file:///frontend/es-portal-vercel/.wrangler/tmp/dev-gQNTPO/index.js:7845:26)
      at async SniffingTransport.request
  (file:///frontend/es-portal-vercel/node_modules/@elastic/transport/src/Transport.ts:744:14)
      at async _Client.GetApi [as get]
  (file:///frontend/es-portal-vercel/node_modules/src/api/api/get.ts:95:10)
      at async Array.<anonymous>
  (file:///frontend/es-portal-vercel/src/index.ts:124:15)
      at async jsonError
  (file:///frontend/es-portal-vercel/node_modules/wrangler/templates/middleware/middleware-miniflare3-json-error.ts:22:10)
      at async drainBody
  (file:///frontend/es-portal-vercel/node_modules/wrangler/templates/middleware/middleware-ensure-req-body-drained.ts:5:10)
  {
    options: { redaction: { type: 'replace', additionalKeys: [] } },
    meta: {
      body: undefined,
      statusCode: 0,
      headers: {},
      meta: {
        context: null,
        request: [Object],
        name: 'elasticsearch-js',
        connection: [Object],
        attempts: 3,
        aborted: false
      },
      warnings: null
    }
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    Status

    Other

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions