Registry / messaging / stentor-service-fetch

stentor-service-fetch

JSON →
library1.72.4jsnpmunverified

Stentor Fetch Service provides a simple fetch wrapper with configurable timeouts for conversational AI applications. Version 1.72.4 is stable with a monthly release cadence. It depends on stentor-models for types and is designed for use in the Stentor framework. Unlike raw fetch or axios, it ensures requests timeout properly in voice/chat contexts where responsiveness is critical. Ships TypeScript types.

npm install stentor-service-fetch
INSTALL
IMPORT
SIG · STENTOR-SERVICE-FE
S
stentor-service-fetch
messagingjavascriptv1.72.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

FetchService
import { FetchService } from 'stentor-service-fetch'
Default export not available; must use named import.
TimeoutError
import { TimeoutError } from 'stentor-service-fetch'
const TimeoutError = require('stentor-service-fetch').TimeoutError
Correct in CommonJS, but ESM is preferred with 'import'.
FetchService
import { FetchService } from 'stentor-service-fetch'
import FetchService from 'stentor-service-fetch'
Named import only, no default export.

Extends FetchService to add a method with timeout and error handling for a weather API.

import { FetchService, TimeoutError } from 'stentor-service-fetch'; class WeatherService extends FetchService { public async getAlerts(state: string): Promise<any> { const url = `https://api.weather.gov/alerts/active?area=${state}`; try { const response = await this.fetch(url); return response.json(); } catch (error) { if (error instanceof TimeoutError) { console.error('Request timed out'); } throw error; } } } const weather = new WeatherService(); weather.getAlerts('TX').then(console.log);
Debug
Known issues
gotchaFetchService does not parse response automatically; you must call response.json() or response.text()
fix
Always chain .then(response => response.json()) or use async/await.
affects: >=1.0.0
gotchaTimeoutError is not exported from index.js in some older versions; check your imports.
fix
Update to >=1.20.0 or import from the internal path.
affects: >=1.0.0 <1.20.0
deprecatedThe default timeout is set to 10000ms; consider setting a custom timeout per request.
fix
Pass options with timeout when calling fetch: this.fetch(url, { timeout: 5000 })
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: this.fetch is not a function
FetchService must be extended; direct instantiation without extending gives no fetch method.
fix
Create a class that extends FetchService and call this.fetch inside its methods.
Error: Cannot find module 'stentor-models'
Missing peer dependency stentor-models.
fix
Run npm install stentor-models.
Upgrade
Version history
1.72.4latest on npm
Audit
Dependencies
stentor-modelsrequiredRequired for type definitions and base classes
Agent activity
17 hits · last 30 days
node
14
Amazon
1
OpenAI (training)
1
Resources
stentor-service-fetch — npm install stentor-service-fetch · libregistry