Skip to content

Commit ee39aaf

Browse files
Ensure fetch is available
1 parent 5710db0 commit ee39aaf

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/api/yepcodeApi.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ export class YepCodeApi {
4949
private timeout: number;
5050

5151
constructor(config: YepCodeApiConfig = {}) {
52+
if (typeof fetch !== "function") {
53+
throw new Error(
54+
`Global fetch API is not available. Please use Node.js 18+ or provide a global fetch polyfill (current node version: ${process.version})`
55+
);
56+
}
5257
const finalConfig = {
5358
apiHost: "https://cloud.yepcode.io",
5459
timeout: 60000,

0 commit comments

Comments
 (0)