Describe the bug
This change introduces an import error with respect to the crypto library when conntecting to secured instances with TLS: 51e34b2
When attempting to instantiate a new instance of the postgres client a worker boot error is thrown:
Uncaught SyntaxError: The requested module './_wasm/mod.ts' does not provide an export named 'DigestAlgorithm'
at https://deno.land/[email protected]/crypto/crypto.ts:108:14
InvalidWorkerCreation: worker boot error
at async Function.create (ext:sb_user_workers/user_workers.js:84:15)
at async Server.<anonymous> (file:///home/deno/main/index.ts:110:24)
at async Server.#respond (https://deno.land/[email protected]/http/server.ts:220:24)
To Reproduce
Steps to reproduce the behavior:
With a new supabase project:
// ./supabase/functions/test/index.ts
import { serve } from "https://deno.land/[email protected]/http/server.ts"
import * as postgres from "https://deno.land/x/postgres/mod.ts"
const databaseUrl = Deno.env.get('SUPABASE_DB_URL')
serve(async (req) => {
const client = new postgres.Client(databaseUrl);
client.connect();
const data = {
message: `Booted!`,
}
return new Response(
JSON.stringify(data),
{ headers: { "Content-Type": "application/json" } },
)
})
-
Start the endpoint
$ supabase functions serve test
-
Get the auth token for the next command, both the anon key and service_role key will work
$ supabase status
-
Call the endpoint
$ curl -v http://localhost:54321/functions/v1/test --header 'Authorization: Bearer <anon or service_role key>'
Expected behavior
An http 200 response is returned with the content:
{ "message": "Booted!" }
Actual Behavior
Server
Client
$ curl -v http://localhost:54321/functions/v1/test --header 'Authorization: Bearer <redacted>'
* Trying [::1]:54321...
* Connected to localhost (::1) port 54321
> GET /functions/v1/test HTTP/1.1
> Host: localhost:54321
> User-Agent: curl/8.4.0
> Accept: */*
> Authorization: Bearer <redacted>
>
< HTTP/1.1 500 Internal Server Error
< Content-Type: application/json
< Content-Length: 50
< Connection: keep-alive
< vary: Accept-Encoding
< date: Thu, 08 Feb 2024 17:10:08 GMT
< X-Kong-Upstream-Latency: 824
< X-Kong-Proxy-Latency: 5
< Via: kong/2.8.1
<
* Connection #0 to host localhost left intact
{"msg":"InvalidWorkerCreation: worker boot error"}%
Additional context
If applicable, add any other context about the problem here.
- deno-postgres version: v0.17.2
- deno version: 1.40.3
Describe the bug
This change introduces an import error with respect to the crypto library when conntecting to secured instances with TLS: 51e34b2
When attempting to instantiate a new instance of the postgres client a worker boot error is thrown:
To Reproduce
Steps to reproduce the behavior:
With a new supabase project:
$ supabase functions new testModify the file test/index.ts
Start the endpoint
$ supabase functions serve testGet the auth token for the next command, both the
anon keyandservice_role keywill work$ supabase statusCall the endpoint
$ curl -v http://localhost:54321/functions/v1/test --header 'Authorization: Bearer <anon or service_role key>'Expected behavior
An http 200 response is returned with the content:
{ "message": "Booted!" }Actual Behavior
Server
Client
Additional context
If applicable, add any other context about the problem here.