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

Fix env detection for Deno in Supabase Edge Functions #1298

Merged
merged 3 commits into from May 17, 2023

Conversation

dqbd
Copy link
Collaborator

@dqbd dqbd commented May 17, 2023

Closes #1268

It does seem like Supabase Deno Functions only provides a global Deno functions without versions property, which will mark isDeno as false and because of NodeJS compat, will mark isNode as true.

This PR aims to correct both of the properties, which is required to force the axios-fetch-adapter in these environments.

@vercel
Copy link

vercel bot commented May 17, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
langchainjs-docs ✅ Ready (Inspect) Visit Preview May 17, 2023 0:44am

@dqbd dqbd requested a review from nfcampos May 17, 2023 11:45
Copy link
Collaborator

@nfcampos nfcampos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

export const isDeno = () => typeof Deno !== "undefined";

// Mark not-as-node if in Supabase Edge Function
export const isNode = () =>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have tried using /* #__PURE__*/, but without much luck

@dqbd dqbd requested a review from nfcampos May 17, 2023 12:57
Copy link
Collaborator

@nfcampos nfcampos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great

@nfcampos nfcampos merged commit fcd3f4d into main May 17, 2023
19 checks passed
@nfcampos nfcampos deleted the supabase-env-detection branch May 17, 2023 13:04
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

Successfully merging this pull request may close these issues.

LLM run errored with error: t is not a function
2 participants