Cannot deploy Edge Function

I've recently started seeing the following error for an Edge Function that used to work fine: "worker boot error: Uncaught SyntaxError: The requested module 'https://esm.sh/contentful-management@11.41.0' does not provide an export named 'default'\n at file:///var/tmp/sb-compile-edge-runtime/transactional/contentful.ts:1:8" Here is the offending code:
import contentfulMgmt from "https://esm.sh/contentful-management@11.41.0";
export const SPACE_ID = Deno.env.get("CF_SPACE_ID");
export const ENVIRONMENT_ID = Deno.env.get("CF_ENVIRONMENT_ID");
const ACCESS_TOKEN = Deno.env.get("CF_ACCESS_TOKEN");
if (!SPACE_ID || !ENVIRONMENT_ID || !ACCESS_TOKEN) {
throw new Error("Contentful configuration missing");
}
export const contentful = contentfulMgmt.createClient({
accessToken: ACCESS_TOKEN
}, {
type: "plain",
defaults: {
spaceId: SPACE_ID,
environmentId: ENVIRONMENT_ID
}
});
export function wrapFieldLocale(data) {
return {
"en-US": data
};
}`
import contentfulMgmt from "https://esm.sh/contentful-management@11.41.0";
export const SPACE_ID = Deno.env.get("CF_SPACE_ID");
export const ENVIRONMENT_ID = Deno.env.get("CF_ENVIRONMENT_ID");
const ACCESS_TOKEN = Deno.env.get("CF_ACCESS_TOKEN");
if (!SPACE_ID || !ENVIRONMENT_ID || !ACCESS_TOKEN) {
throw new Error("Contentful configuration missing");
}
export const contentful = contentfulMgmt.createClient({
accessToken: ACCESS_TOKEN
}, {
type: "plain",
defaults: {
spaceId: SPACE_ID,
environmentId: ENVIRONMENT_ID
}
});
export function wrapFieldLocale(data) {
return {
"en-US": data
};
}`
What I've tried: - Referencing npm directly in the import: import contentfulMgmt from "npm:contentful-management@11.41.0"; - Using a wildcard import: import * as contentfulMgmt from "https://esm.sh/contentful-management@11.41.0"; - Deploying from the CLI with the --debug flag (When I tried this, it hangs at the following point:
Using access token for profile: supabase
Loading project ref from file: supabase/.temp/project-ref
Supabase CLI 2.62.5
Using profile: supabase (supabase.co)
Using access token for profile: supabase
Loading project ref from file: supabase/.temp/project-ref
Supabase CLI 2.62.5
Using profile: supabase (supabase.co)
I'm at my wits end as to what is going on! This same Edge Function was working yesterday just fine.
1 Reply
jahbrewski
jahbrewskiOP3d ago
I ultimately was able to get this to deploy by using the --use-api flag on the CLI. While I'm not sure why that fixed the issue (was I not already using the API? Or perhaps that's just confusing naming?), this appears to be working now.

Did you find this page helpful?