-
Notifications
You must be signed in to change notification settings - Fork 63
Open
Description
Hello, node-acme-client is an excellent project!
I hope to use for the development of Cloudflare Worker.
However, when I was using Client.creatOrder
in the Hono based Worker project, I encountered an error:
X [ERROR] AxiosError: There is no suitable adapter to dispatch the request - adapter http is not available in the build
at Object.getAdapter
(file:///G:/Codes/CFWorkerACME/node_modules/axios/lib/adapters/adapters.js:70:13)
at Axios.dispatchRequest
(file:///G:/Codes/CFWorkerACME/node_modules/axios/lib/core/dispatchRequest.js:49:28)
at async Axios.request
(file:///G:/Codes/CFWorkerACME/node_modules/axios/lib/core/Axios.js:40:14)
at async HttpClient.request
(file:///G:/Codes/CFWorkerACME/node_modules/acme-client/src/http.js:59:22)
at async HttpClient.getDirectory
(file:///G:/Codes/CFWorkerACME/node_modules/acme-client/src/http.js:120:26)
at async HttpClient.getResourceUrl
(file:///G:/Codes/CFWorkerACME/node_modules/acme-client/src/http.js:178:21)
at async AcmeApi.apiResourceRequest
(file:///G:/Codes/CFWorkerACME/node_modules/acme-client/src/api.js:73:29)
at async AcmeClient.createOrder
(file:///G:/Codes/CFWorkerACME/node_modules/acme-client/src/client.js:296:22)
at async newApply (file:///G:/Codes/CFWorkerACME/src/certs.ts:58:24)
at async Processing (file:///G:/Codes/CFWorkerACME/src/certs.ts:14:38)
at Axios.request (file:///G:/Codes/CFWorkerACME/node_modules/axios/lib/core/Axios.js:45:41)
at async HttpClient.request
(file:///G:/Codes/CFWorkerACME/node_modules/acme-client/src/http.js:59:22)
at async HttpClient.getDirectory
(file:///G:/Codes/CFWorkerACME/node_modules/acme-client/src/http.js:120:26)
at async HttpClient.getResourceUrl
(file:///G:/Codes/CFWorkerACME/node_modules/acme-client/src/http.js:178:21)
at async AcmeApi.apiResourceRequest
(file:///G:/Codes/CFWorkerACME/node_modules/acme-client/src/api.js:73:29)
at async AcmeClient.createOrder
(file:///G:/Codes/CFWorkerACME/node_modules/acme-client/src/client.js:296:22)
at async newApply (file:///G:/Codes/CFWorkerACME/src/certs.ts:58:24)
at async Processing (file:///G:/Codes/CFWorkerACME/src/certs.ts:14:38)
at null.<anonymous> (async
file:///G:/Codes/CFWorkerACME/.wrangler/tmp/dev-22lPSI/index.js:79434:3)
at async dispatch (file:///G:/Codes/CFWorkerACME/node_modules/hono/dist/compose.js:22:17) {
code: 'ERR_NOT_SUPPORT'
}
After searching, it was found that 'Axios.request' is incompatible with Service Worker
It needs to be replaced with Xior to work.
I believe there is a possibility and requirement for compatibility with Service Workers in this project
So I request a change to change Axios to Xior
Content that needs to be modified:
http.js
...
import xior from 'xior';
...
async request(url, method, opts = {}) {
...
// const resp = await axios.request(opts);
let resp = await xior.request(opts);
const headers = {};
for (const [key, value] of resp.headers) {
headers[key] = value;
}
resp.headers = headers
...
}
...
This is just a suggestion. If you could make any modifications, I would greatly appreciate it.
Actually, I have forked one and made modifications to make my Worker work properly
Metadata
Metadata
Assignees
Labels
No labels