Skip to content

Receiving 404 when calling edge function with langchain libraries in import_map.json #401

Open
@iliskhan

Description

@iliskhan

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

When running the edge function locally, everything works as expected. However, after deploying it to production, I receive a 404 error in the invocations section of the monitoring dashboard. The logs section does not display any information, making it difficult to diagnose the issue.

I suspect that the problem is related to the Langchain libraries included in the import_map.json file. I identified this by commenting out all imports and then uncommenting them one by one until the error reappeared. Previously, I encountered a similar issue and resolved it by adjusting the import sources (some libraries were imported from npm, others from esm). However, this time, I have tried multiple sources, but the problem persists.

To Reproduce

Steps to reproduce the behavior:

  1. Deploy the edge function with Langchain libraries included in the import_map.json file.
  2. Attempt to invoke the function in the production environment.
  3. Check the invocations section in the monitoring dashboard and observe the 404 error.
  4. Notice that no logs are generated in the logs section.

Expected behavior

The edge function should execute successfully without a 404 error, and logs should be generated to assist in troubleshooting.

Screenshots

image

System information

  • OS: [e.g. macOS, Windows]
  • Browser (if applies) [e.g. chrome, safari]
  • Version of supabase-js: [e.g. 6.0.2]
  • Version of Node.js: [e.g. 10.10.0]

Additional context

To rule out potential network issues related to accessing npm and esm in different regions, I created a separate project and deployed it in another country, but the issue persisted.

import_map.json

{
  "imports": {
    "axios": "npm:[email protected]",

    "zod": "https://deno.land/x/[email protected]/index.ts",
    "djwt": "https://deno.land/x/[email protected]/mod.ts",
    "zod/types": "https://deno.land/x/[email protected]/types.ts",

    "cron-parser": "https://esm.sh/[email protected]",

    "@langchain/openai": "https://esm.sh/@langchain/[email protected]",

    "@langchain/langgraph": "npm:@langchain/[email protected]",
    "@langchain/langgraph/prebuilt": "npm:@langchain/[email protected]/prebuilt",

    "@langchain/core": "npm:@langchain/[email protected]",
    "@langchain/core/tools": "npm:@langchain/[email protected]/tools",
    "@langchain/core/agents": "npm:@langchain/[email protected]/agents",
    "@langchain/core/prompts": "npm:@langchain/[email protected]/prompts",
    "@langchain/core/messages": "npm:@langchain/[email protected]/messages",
    "@langchain/core/runnables": "npm:@langchain/[email protected]/runnables",
    "@langchain/core/callbacks/manager": "npm:@langchain/[email protected]/callbacks/manager",
    "@langchain/core/utils/function_calling": "npm:@langchain/[email protected]/utils/function_calling"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: something isn't workingC-hostedCategory: hosted related

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions