AUR5000
Error Message
AUR5000: Could not resolve fetch function. Please provide a fetch function implementation or a polyfill for the global fetch function.
Description
This error occurs when the Aurelia Fetch Client cannot find a fetch function implementation. The fetch client requires either:
A global
fetchfunction (available in modern browsers and Node.js 18+)A polyfill for environments that don't support fetch natively
A custom fetch implementation provided during configuration
Common Scenarios
Node.js Environments (pre-18)
// Node.js versions before 18 don't have global fetch
import { HttpClient } from '@aurelia/fetch-client';
// This will throw AUR5000
const client = new HttpClient();Server-Side Rendering
Solutions
1. Use Node.js 18+ (Recommended)
Node.js 18+ includes global fetch support:
2. Install a Fetch Polyfill
For older environments, install a fetch polyfill:
3. Configure Custom Fetch Implementation
Provide a custom fetch function during HttpClient configuration:
4. Dependency Injection Configuration
Configure the fetch function at the container level:
Example: Complete SSR Setup
Debugging Tips
Check Environment: Verify if your runtime environment supports global fetch
Import Order: Ensure polyfills are imported before any Aurelia code
SSR Context: Pay special attention to server-side rendering scenarios
Node.js Version: Consider upgrading to Node.js 18+ for native fetch support
Last updated
Was this helpful?