supabase / edge-runtime

A server based on Deno runtime, capable of running JavaScript, TypeScript, and WASM services.
MIT License
649 stars 58 forks source link

After restarting project postgresjs can no longer connect `ops.op_set_keepalive is not a function` #81

Closed evelant closed 1 year ago

evelant commented 1 year ago

Bug report

Describe the bug

After restarting project postgresjs can no longer connect, it throws ops.op_set_keepalive is not a function. There have been no changes to my code. I only restarted my project via the Supabase dashboard due to an unrelated issue.

It seems that maybe there were some changes to the edge runtime that cause some deno APIs to no longer function correctly?

TypeError: ops.op_set_keepalive is not a function
    at TcpConn.setKeepAlive (ext:deno_net/01_net.js:162:16)
   at Object.setKeepAlive (https://deno.land/x/postgresjs@v3.3.4/polyfills.js:37:61)
    at connected (https://deno.land/x/postgresjs@v3.3.4/src/connection.js:365:51)
    at https://deno.land/x/postgresjs@v3.3.4/polyfills.js:150:32
    at Array.forEach (<anonymous>)
    at call (https://deno.land/x/postgresjs@v3.3.4/polyfills.js:150:18)
    at success (https://deno.land/x/postgresjs@v3.3.4/polyfills.js:103:11)
    at eventLoopTick (ext:core/01_core.js:166:11)
    at cachedError (https://deno.land/x/postgresjs@v3.3.4/src/query.js:171:23)
    at new Query (https://deno.land/x/postgresjs@v3.3.4/src/query.js:36:24)
    at sql (https://deno.land/x/postgresjs@v3.3.4/src/index.js:112:11)
    at file:///src/index.ts:153:61"}

To Reproduce

  1. Deploy an edge function that connects to the db with postgresjs
  2. Observe that connection fails with the above error

Expected behavior

Code that worked previously should continue to work unless a breaking change has been announced

Screenshots

If applicable, add screenshots to help explain your problem.

System information

Additional context

N/A

laktek commented 1 year ago

@evelant Are you experiencing this issue both locally and after you deploy to production? There seems to be an ongoing Deno Deploy outage that may be the cause of this https://denostatus.com/

evelant commented 1 year ago

This issue is only happening in production. My code did not change. This started happening immediately after I restarted my production Supabase instance.The Deno Deploy issue doesn’t appear to be related as far as I can tell.

I’m not sure how this is possible, but the failure appears to be here https://github.com/denoland/deno/blob/a6c47ee74023f6ef683988cabc8caa95406e3c99/ext/net/01_net.js#L169 where Deno is calling into its native rust code here https://github.com/denoland/deno/blob/a6c47ee74023f6ef683988cabc8caa95406e3c99/ext/net/ops.rs#L673. That’s why I suspect that it could be an issue with Supabase’s custom runtime, but I can’t be certain.

Hopefully we can figure this out, my app is still in a total outage due to this.

Andrew

On May 5, 2023, at 2:31 PM, Lakshan Perera @.***> wrote:

@evelant https://github.com/evelant Are you experiencing this issue both locally and after you deploy to production? There seems to be an ongoing Deno Deploy outage that may be the cause of this https://denostatus.com/

— Reply to this email directly, view it on GitHub https://github.com/supabase/edge-runtime/issues/81#issuecomment-1536625270, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGRWVOZEUTXHTKBHQW76R3XEVBQLANCNFSM6AAAAAAXXKQD5Q. You are receiving this because you were mentioned.

laktek commented 1 year ago

@evelant We don't run the Edge Runtime in production. I will share this with Deno Deploy team to see if they can find what the issue is.

evelant commented 1 year ago

Hmm perhaps it is an issue with Deno Deploy. My staging instance (which was not restarted or changed in any way) is experiencing the same problem.

evelant commented 1 year ago

@laktek some more clues here https://github.com/denoland/deploy_feedback/issues/382#issuecomment-1536587625

It appears there may have been a change in Deno Deploy to remove "disabled ops" entirely. It seems they may have silently removed APIs even though existing code was using them.

laktek commented 1 year ago

Yep, I got an update from Deno Deploy team that they are rolling out a fix for it.

evelant commented 1 year ago

At least as of now it's still down. Did they give any ETA on this fix?

laktek commented 1 year ago

Looks like it waa fixed https://github.com/denoland/deploy_feedback/issues/382