Code Monkey home page Code Monkey logo

Comments (23)

laktek avatar laktek commented on June 3, 2024 2

Supabase CLI 1.52.3+ should include the Edge Runtime with the fix. cc: @DeanWard @vejja

from edge-runtime.

vejja avatar vejja commented on June 3, 2024 1

Wonderful - fixed !
Thanks guys

from edge-runtime.

vejja avatar vejja commented on June 3, 2024

Additional info :

  • broken somewhere between supabase-cli 1.47.5 and 1.50.4
  • not solved as of supabase-cli 1.50.8

Linking to supabase-cli as it might be a better place to report

from edge-runtime.

nminchow avatar nminchow commented on June 3, 2024

I'm getting this as well. I've also noticed the following behavior. If I send:

OPTIONS http://localhost:54321/functions/v1/function-name

with no headers, the response fails. If I include a body in the options request:

OPTIONS http://localhost:54321/functions/v1/function-name

{
  "name": "test"
}

The response succeeds.

from edge-runtime.

joshmarnold avatar joshmarnold commented on June 3, 2024

I'm also seeing this. Posted about it on Discord

@ltanady

from edge-runtime.

vejja avatar vejja commented on June 3, 2024

@soedirgo : Not sure whether this is relevant to edge-runtime, but I think DELETE requests also have an empty body.
Anyways many thanks for the fix 🚀

from edge-runtime.

Aaron3219 avatar Aaron3219 commented on June 3, 2024

Additional info :

  • broken somewhere between supabase-cli 1.47.5 and 1.50.4
  • not solved as of supabase-cli 1.50.8

Linking to supabase-cli as it might be a better place to report

supabase-cli 1.48.1 is still working. So it must be between 1.48.1 and 1.50.4

from edge-runtime.

andreespirela avatar andreespirela commented on June 3, 2024

image

cc @laktek I'm not able to reproduce this bug in the latest main. Can we close?

from edge-runtime.

laktek avatar laktek commented on June 3, 2024

@andreespirela Can you try other HTTP verbs like DELETE and confirm everything works without a request body?

from edge-runtime.

andreespirela avatar andreespirela commented on June 3, 2024

@laktek Getting this instead

{
    "msg": "Error: channel closed"
}

Investigating.

from edge-runtime.

andreespirela avatar andreespirela commented on June 3, 2024

We are weirdly handling when a request has a body

    async fetch(req) {
        const { method, url, headers, body, bodyUsed } = req;

        const headersArray = Array.from(headers.entries());
        const hasBody = false;

        const userWorkerReq = {
            method,
            url,
            headers: headersArray,
            hasBody,
        };

        const { requestRid, requestBodyRid } = await ops.op_user_worker_fetch_build(userWorkerReq);

        // stream the request body
        if (hasBody) {
            let writableStream = writableStreamForRid(requestBodyRid);
            body.pipeTo(writableStream);
        }

        const res = await core.opAsync("op_user_worker_fetch_send", this.key, requestRid);
        const bodyStream = readableStreamForRid(res.bodyRid);
        return new Response(bodyStream, {
            headers: res.headers,
            status: res.status,
            statusText: res.statusText
        });
    }

hasBody
cc @laktek

from edge-runtime.

vejja avatar vejja commented on June 3, 2024

We are weirdly handling when a request has a body

Agree - See #69 (comment)

from edge-runtime.

github-actions avatar github-actions commented on June 3, 2024

🎉 This issue has been resolved in version 1.2.18 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

from edge-runtime.

DeanWard avatar DeanWard commented on June 3, 2024

I feel like i'm missing something obvious here but I cannot work out how to get my local supabase to use the latest version.

I've updated supabase CLI via homebrew but it's still pulling down edge runtime v1.2.12 from docker, i've manually deleted all the images and allowed supabase to re pull them but it's still pulling the old version.

from edge-runtime.

laktek avatar laktek commented on June 3, 2024

@DeanWard We haven't updated Supabase CLI to use the latest Edge Runtime yet. Expect a new release today.

from edge-runtime.

CareTiger avatar CareTiger commented on June 3, 2024

@laktek Lakshan - i updated my cli this morning and i only have 1.52.2. when will 1.52.3 be release? thank

from edge-runtime.

laktek avatar laktek commented on June 3, 2024

@CareTiger 1.52.3 should already be available. Can you try upgrading again?

from edge-runtime.

CareTiger avatar CareTiger commented on June 3, 2024

still doesnt work. serving the request with /home/deno/functions/hello-world Error: channel closed at async Function.create (ext:sb_user_workers/user_workers.js:75:21) at async Server.<anonymous> (file:///home/deno/main/index.ts:94:24) at async Server.#respond (https://deno.land/[email protected]/http/server.ts:220:24)

from edge-runtime.

CareTiger avatar CareTiger commented on June 3, 2024

@laktek supabase --version
1.52.3

from edge-runtime.

laktek avatar laktek commented on June 3, 2024

@CareTiger Can you share the request you are making? Also, the code for the hello-world function?

from edge-runtime.

CareTiger avatar CareTiger commented on June 3, 2024

I have filed a ticket. my project reference is zkcmpwzbigjgwiesauro. here is the code ```
// @ts-ignore: module not found
import { serve } from "server";
// @ts-ignore: module not found
import { corsHeaders } from "cors";

// console.log("Hello from Functions!");

serve(async (req: Request) => {
if (req.method === "OPTIONS") {
return new Response("ok", { headers: corsHeaders });
}
const { pathname: path, searchParams: query } = new URL(req.url);
console.log(path);
console.log(req.url);
// get the payload from the request
const payload = await req.json();

console.log(payload.user_id);

return new Response(JSON.stringify(`Hello ${payload.user_id}!`), {
    headers: {
        ...corsHeaders,
    },
});

});```

from edge-runtime.

CareTiger avatar CareTiger commented on June 3, 2024

@laktek others are facing the same issue - https://discord.com/channels/839993398554656828/1097177678412533903/1103052379877818419

from edge-runtime.

laktek avatar laktek commented on June 3, 2024

An update: Looks like @CareTiger's issue was caused due to a bug in CLI handling import maps. Will do a fix for it soon (check the above Discord thread for more details)

from edge-runtime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.