coinbase / coinbase/onchainkit

Bug: Add clearer error for missing API key or invalid OnchainKitProvider config

Open
#2,560 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1k
Forks
520
Avg merge
32m
Merged PRs (30d)
2

Description

### Describe the bug and the steps to reproduce it

Description:
When `OnchainKitProvider` is initialized without a required API key or with an invalid configuration, the resulting error messages can be unclear or appear deep in the stack trace. This makes it difficult for developers to quickly identify configuration issues during initial setup.

Proposed solution:
- Validate required configuration fields (`apiKey`, `projectId`, `rpcUrl`, etc.) during provider initialization.
- Throw a descriptive, user-facing error when validation fails.
- Update documentation to clearly list required provider configuration options.

Acceptance criteria:
- Error is thrown early and clearly when configuration is invalid.
- Error message explicitly names the missing or invalid field.
- Documentation includes a minimal, correct configuration example.

### What's the expected behavior?

- Provider initialization fails fast when required configuration is missing.
- Error message clearly states which configuration field is missing or invalid.
- Error includes a short suggestion on how to fix the issue.

### What version of the libraries are you using?

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.