1

I am trying to write a supabase edge function with deno.

But I can see that when I run this command.

create edge function

npx supabase functions new FUNCTION-NAME

It creates a function file called index.ts but I am not comfortable with typescript.

Is there a way to create a function with on javascript?

3
  • 2
    If you can't find a solution here, it's worth noting that TypeScript is a superset of JavaScript. Thus you're okay to write pure JavaScript code inside index.ts. Commented Aug 25, 2023 at 17:14
  • Did you try changing the file's extension to .js? If that doesn't work, you can create a new JavaScript module (e.g. main.js) and write your code there. Then change the contents of the existing entrypoint module (index.ts) to import "./main.js"; to load and execute it. Commented Aug 26, 2023 at 1:15
  • yes I did and it doesn't work. That is why i am asking the question here. Commented Aug 29, 2023 at 21:54

1 Answer 1

0

Now it's possible, you just have to add the file path in the config.toml:

[functions.hello-world]
# other entries
entrypoint = './functions/hello-world/index.js' # path must be relative to config.toml

entrypoint is available only in Supabase CLI version 1.215.0 or higher.

https://supabase.com/docs/guides/functions/quickstart#not-using-typescript

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.