Skip to content

README: pass a bare host name to ConvertApi.auth - #34

Merged
tomasr78 merged 1 commit into
mainfrom
readme-bare-host
Nov 12, 2026
Merged

tomasr78 merged 1 commit into
mainfrom
readme-bare-host

Conversation

@tomasr78

Copy link
Copy Markdown
Contributor

What

The "Alternative domain" example in README.md passed a URL as the host:

let convertApi = ConvertApi.auth('api-token', 'https://eu-v2.convertapi.com/')

The library expects a bare host name. It builds request URLs as https://${this.host}/convert/... (src/convertapi.ts)
and https://${this.host}/upload?... (src/file-param.ts). With the README's value, every request went to
https://https://eu-v2.convertapi.com//convert/.... The URL parser reads https as the host, so the request fails
with TypeError: fetch failed (ENOTFOUND). The example has been wrong since it was added on 2023-07-04 in
93fa8fe; the library
already prefixed https:// then.

This PR changes the example to

let convertApi = ConvertApi.auth('api-token', 'eu-v2.convertapi.com')

and rewrites the sentence above it. The sentence now says that the second argument is a host name without https://
or a trailing slash, that the default is v2.convertapi.com, and where the regional hosts are listed. The change is
in README.md only; the code is unchanged.

Checks

  • https://www.convertapi.com/docs/servers-location lists eight hosts: v2, uk-v2, eu-v2, us-v2, ca-v2,
    as-v2, jp-v2 and au-v2 (all .convertapi.com). On 2026-11-12 all eight resolved and answered the API
    (401 without credentials). The README names only v2.convertapi.com and eu-v2.convertapi.com.
  • node --test test/live.test.js with a staging token and CONVERT_API_HOST=stag-v2.convertapi.com, a bare host:
    3 of 3 pass.
  • The README's line, run against eu-v2 with an invalid token:
    • new form: the API answers with error 4011, "Unauthorized. Invalid or missing API credentials."
    • old form: fetch failed (ENOTFOUND https), before any request reaches ConvertAPI.
  • test/convertapi.test.js already passes a bare host ('example.test').
  • No conflict with Publish stable releases under the npm dist-tag latest #33, which adds one line near the top
    of README.md (checked with git merge-tree). Either PR can merge first.

The same mistake on convertapi.com

🤖 Generated with Claude Code

The "Alternative domain" example passed 'https://eu-v2.convertapi.com/'.
The library builds request URLs as https://${host}/convert/... and
https://${host}/upload?..., so that value produced
https://https://eu-v2.convertapi.com//convert/..., which looks up a host
named "https" and fails with "fetch failed" (ENOTFOUND). The example has
been wrong since it was added on 2023-07-04.

Use 'eu-v2.convertapi.com', say that the argument is a host name without
https:// or a trailing slash, and name the default host.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 12, 2026 12:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

There are no active review issues for this README-only change clarifying the regional host argument format.

No open issues 🎉

What changed in this PR

Corrects the README’s regional-server example to match the host-name format expected by ConvertApi.auth. No library code changes.

Changes:

  • Removes https:// and the trailing slash from the example host.
  • Clarifies the second argument’s format, documents the default host, and retains the link to regional server locations.
File Description
README.md Fixes the regional-host example and clarifies host argument requirements.

Review effort: Balanced

@tomasr78
tomasr78 merged commit 3f618af into main Nov 12, 2026
5 checks passed
@tomasr78
tomasr78 deleted the readme-bare-host branch November 12, 2026 13:12
tomasr78 added a commit that referenced this pull request Nov 12, 2026
Brings in #34, which changes README.md only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants