Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: fetch is not a function #15

Open
arnaudjnn opened this issue Feb 29, 2024 · 0 comments
Open

TypeError: fetch is not a function #15

arnaudjnn opened this issue Feb 29, 2024 · 0 comments

Comments

@arnaudjnn
Copy link

I have the following error when using a Next.js new app router API route.

TypeError: fetch is not a function (same error for each provider)

Here is my code (/ap/crypto-convert/route.ts)

import { NextResponse } from 'next/server';
import CryptoConvert from 'crypto-convert';

const convert = new CryptoConvert({
  cryptoInterval: 60 * 1e3 * 60, //Crypto prices update interval (every 1 hour)
  fiatInterval: 60 * 1e3 * 60, //Fiat prices update interval (every 1 hour)
});

export async function GET() {
  await convert.ready();

  const currencyConversions = convert.USDC.USD(1)

  return NextResponse.json(currencyConversions, { status: 200 });
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant