Netlify Edge Functions and NPM Compatibility

In regards to Netlify Edge Functions, it looks like Deno now allows imports from NPM. I am trying to do this in my Netlify Edge Function:

import { Configuration, OpenAIApi } from "npm:openai@^3.2.1";

However, this does not work, even though it should according to Deno’s docs. I get this error:

TypeError: Unsupported scheme "npm" for module "npm:openai@^3.2.1". Supported schemes: [

Is this still not allowed? What version of Deno does Netlify Edge Functions use? I would love to use npm packages, especially the official OpenAi API package. I would also like to use this like:

import { readFileSync } from "node:fs";

Is this possible?

Not at the moment, @st3phhays. But that’s on the roadmap. Unfortunately, we don’t have a timeline for that yet.

1 Like