transformer-oembed
transformer-oembed copied to clipboard
[Feature request] Get a list of providers without HTTP request
Environments
@remark-embedder/transformer-oembedversion: v3.0.0nodeversion: v18.16.0npmversion: v9.5.0
Relevant code or config:
https://github.com/remark-embedder/transformer-oembed/blob/ebeecb4064bb3b926a04965404df2ef8c25fa535/src/index.ts#L29-L36
What you did:
- I tried to use
@remark-embedder/core(with@remark-embedder/transformer-oembed) as a remark plugin for MDX v2. - I was going to use GitHub to manage the markdown and other static files, and Cloudflare Pages to build and deploy them.
What happened:
ECONNRESEThappend.
Error: MDX compilation failed for file "/opt/buildhome/repo/content/docs/index.mdx"
--
Cause: request to https://oembed.com/providers.json failed, reason: Client network socket disconnected before secure TLS connection was established
Details:
{
"code": "ECONNRESET",
"path": null,
"host": "oembed.com",
"port": 443,
"errno": "ECONNRESET",
"type": "system"
}
Reproduction repository:
- N/A
Problem description:
Presumably, the Cloudflare Pages build environment is placed under their proxy environment and HTTP requests to the outside world are closed.
Suggested solution:
There should be an alternative way to obtain JSON data without going through communication with the outside world; i.e., the following two solutions could be considered:
- Write provider information obtained from URL as
Objectin the code. - Provide an option to load a pre-prepared JSON file.
The former method is NOT recommended because the amount of code becomes bloated, and the time required to update information increases. Therefore, the latter method is recommended, as it seems to solve the problem without burdening the developer.