Skip to content

Error under electron: Adapter 'http' is not available in the build #332

Open
@crystalfp

Description

@crystalfp

Expected Behavior

Used nano without errors under Node 20.4.0. I want to use the exactly same code under Electron that bundles Node 18.16.1

Current Behavior

At the first call to nano

import Nano from "nano";
const nano = Nano({url: "my-CouchDB-url", requestDefaults: {timeout: 120_000}});
const databaseList = await nano.db.list();

I receive the error:

Adapter 'http' is not available in the build

Seems the error is generated by axios and seems the solution is to move to fetch. There is a possible workaround at axios/axios#5523 but setting agent in the requestDefaults has no effect.

Possible Solution

  1. scrap axios and use fetch :-)
  2. document a way to change axios adapter from outside. Agent option seems that does not change anything.

Steps to Reproduce (for bugs)

  1. Create an Electron application
  2. In the main.js (that is, the Node process) add the lines listed above (putting a known CouchDB url).
  3. Run npm run dev
  4. See the error

Context

Well, this problem blocks entirely my porting of the client-server application under Electron.
If there is no solution I have to scrap CouchDB and move to another DB.

Your Environment

  • Version used: 10.1.2
  • Browser Name and version: Electron 26.0.0 that runs Node 18.16.1. Not run in browser.
  • Operating System and version (desktop or mobile): Windows 11 64bits desktop
  • Link to your project: Not public

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