apache / apache/couchdb-nano

Request for ETA on New Release Supporting Axios 1.x Version

Open
#349 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
689
Forks
167
Avg merge
1h
Merged PRs (30d)
1

Description

The nano library is currently incompatible with axios@1.x because it uses the CommonJS require('axios') syntax in lib/nano.js. Since axios@1.x has transitioned to ES Modules (ESM), this usage results in runtime errors when attempting to use the library with axios@1.x.

Affected Code

In lib/nano.js:

const axios = require('axios');
This usage causes the following error when running the code with axios@1.x:

Error [ERR_REQUIRE_ESM]: require() of ES Module is not supported

Steps to Reproduce
Install nano and axios@1.x in a Node.js project:
npm install nano axios@1.6.3
Import or require nano in your code:
const nano = require('nano');
Attempt to use nano to make an HTTP request.
Observe the runtime error indicating incompatibility with ES Modules.

Expected Behavior
nano should support axios@1.x by replacing the require('axios') syntax with the ES Modules import syntax:

import axios from 'axios';

Proposed Solution
Update all instances of require('axios') in the codebase to use import:
import axios from 'axios';
Update the package.json file to specify a peer dependency on axios@^1.0.0 to ensure compatibility:
"peerDependencies": {
"axios": "^1.0.0"
}

Additional Context
axios@1.x includes critical security updates and new features, making its adoption essential for projects aiming to maintain secure and modern applications.
The current incompatibility blocks projects from upgrading to axios@1.x if they depend on nano.

Request
Please update the nano codebase to support axios@1.x. If needed, I am happy to assist with additional details or contribute a pull request to resolve the issue.

Environment
Node.js Version: [e.g., 16.x or 18.x]
Axios Version: 1.6.3
nano Version: [e.g., 9.x]
Operating System: [e.g., macOS, Windows, or Linux]

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported ERR_REQUIRE_ESM failure with nano, axios@1.6.3, and the Node.js versions mentioned. Read lib/nano.js for every axios usage and package.json for dependency declarations; done means nano can make its HTTP requests with axios 1.x without the reported runtime error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.