Skip to content

fern-go: generated README has two snippets that don't compile or panic (header auth) #17459

Description

@adidavid014

Summary

Two snippets in the generated Go README.md are wrong for SDKs using header-based auth. Both come from the README template, so every such customer gets them.

Observed on fern-go-sdk 1.57.2 / CLI 5.98.2.

1. option.WithToken does not exist

The Request Options section shows this twice:

client.Endpoint(..., option.WithToken("<YOUR_API_KEY>"))

For a header-auth SDK the option set is WithSecret / WithClientID / WithVersion — there is no WithToken. The snippet does not compile.

2. The Errors snippet panics

var apiError *core.APIError
if errors.As(err, apiError) {   // missing &

Running it verbatim:

panic: errors: target must be a non-nil pointer

Should be errors.As(err, &apiError).

Expected

  • Render the auth option that the SDK actually generates, rather than assuming bearer-token auth.
  • Fix the errors.As call to pass a pointer.

Also missing (lower priority)

For an SDK with paginated endpoints, the README has no Pagination section. Ours has 32 methods returning *core.Page[...] and nothing documents how to iterate them, which is the feature most likely to go unused for lack of an example.

The README also doesn't mention the env-var fallbacks the client implements (PLAID_SECRET, PLAID_CLIENT_ID, PLAID_VERSION in our case), even though NewClient reads them.

Found while reviewing a customer SDK for release readiness — these were the only issues in an otherwise clean generated repo, but they are the first thing a customer copy-pastes.

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