-
Notifications
You must be signed in to change notification settings - Fork 95
Description
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/std@0.214.0/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/std@0.182.0/http/server.ts:220:24)
To Reproduce
Steps to reproduce the behavior:
With a new supabase project:
-
$ supabase functions new test
-
Modify the file test/index.ts
// ./supabase/functions/test/index.ts
import { serve } from "https://deno.land/std@0.168.0/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
andservice_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
$ supabase functions serve test
Setting up Edge Functions runtime...
Download https://deno.land/std@0.182.0/http/server.ts
Download https://deno.land/x/jose@v4.13.1/index.ts
Download https://deno.land/std@0.182.0/async/mod.ts
Download https://deno.land/x/jose@v4.13.1/jwe/compact/decrypt.ts
Download https://deno.land/x/jose@v4.13.1/jwe/flattened/decrypt.ts
Download https://deno.land/x/jose@v4.13.1/jwe/general/decrypt.ts
Download https://deno.land/x/jose@v4.13.1/jwe/general/encrypt.ts
Download https://deno.land/x/jose@v4.13.1/jws/compact/verify.ts
Download https://deno.land/x/jose@v4.13.1/jws/flattened/verify.ts
Download https://deno.land/x/jose@v4.13.1/jws/general/verify.ts
Download https://deno.land/x/jose@v4.13.1/jwt/verify.ts
Download https://deno.land/x/jose@v4.13.1/jwt/decrypt.ts
Download https://deno.land/x/jose@v4.13.1/jwe/compact/encrypt.ts
Download https://deno.land/x/jose@v4.13.1/jwe/flattened/encrypt.ts
Download https://deno.land/x/jose@v4.13.1/jws/compact/sign.ts
Download https://deno.land/x/jose@v4.13.1/jws/flattened/sign.ts
Download https://deno.land/x/jose@v4.13.1/jws/general/sign.ts
Download https://deno.land/x/jose@v4.13.1/jwt/sign.ts
Download https://deno.land/x/jose@v4.13.1/jwt/encrypt.ts
Download https://deno.land/x/jose@v4.13.1/jwk/thumbprint.ts
Download https://deno.land/x/jose@v4.13.1/jwk/embedded.ts
Download https://deno.land/x/jose@v4.13.1/jwks/local.ts
Download https://deno.land/x/jose@v4.13.1/jwks/remote.ts
Download https://deno.land/x/jose@v4.13.1/jwt/unsecured.ts
Download https://deno.land/x/jose@v4.13.1/key/export.ts
Download https://deno.land/x/jose@v4.13.1/key/import.ts
Download https://deno.land/x/jose@v4.13.1/util/decode_protected_header.ts
Download https://deno.land/x/jose@v4.13.1/util/decode_jwt.ts
Download https://deno.land/x/jose@v4.13.1/util/errors.ts
Download https://deno.land/x/jose@v4.13.1/key/generate_key_pair.ts
Download https://deno.land/x/jose@v4.13.1/key/generate_secret.ts
Download https://deno.land/x/jose@v4.13.1/util/base64url.ts
Download https://deno.land/x/jose@v4.13.1/lib/is_object.ts
Download https://deno.land/x/jose@v4.13.1/runtime/fetch_jwks.ts
Download https://deno.land/x/jose@v4.13.1/runtime/env.ts
Download https://deno.land/x/jose@v4.13.1/runtime/base64url.ts
Download https://deno.land/x/jose@v4.13.1/runtime/asn1.ts
Download https://deno.land/x/jose@v4.13.1/runtime/jwk_to_key.ts
Download https://deno.land/x/jose@v4.13.1/lib/buffer_utils.ts
Download https://deno.land/x/jose@v4.13.1/runtime/generate.ts
Download https://deno.land/x/jose@v4.13.1/runtime/key_to_jwk.ts
Download https://deno.land/x/jose@v4.13.1/jwt/produce.ts
Download https://deno.land/x/jose@v4.13.1/lib/cek.ts
Download https://deno.land/x/jose@v4.13.1/lib/is_disjoint.ts
Download https://deno.land/x/jose@v4.13.1/lib/encrypt_key_management.ts
Download https://deno.land/x/jose@v4.13.1/lib/validate_crit.ts
Download https://deno.land/std@0.182.0/async/abortable.ts
Download https://deno.land/std@0.182.0/async/deadline.ts
Download https://deno.land/std@0.182.0/async/debounce.ts
Download https://deno.land/std@0.182.0/async/deferred.ts
Download https://deno.land/std@0.182.0/async/delay.ts
Download https://deno.land/std@0.182.0/async/mux_async_iterator.ts
Download https://deno.land/std@0.182.0/async/pool.ts
Download https://deno.land/std@0.182.0/async/tee.ts
Download https://deno.land/std@0.182.0/async/retry.ts
Download https://deno.land/x/jose@v4.13.1/runtime/decrypt.ts
Download https://deno.land/x/jose@v4.13.1/runtime/zlib.ts
Download https://deno.land/x/jose@v4.13.1/lib/decrypt_key_management.ts
Download https://deno.land/x/jose@v4.13.1/lib/validate_algorithms.ts
Download https://deno.land/x/jose@v4.13.1/lib/jwt_claims_set.ts
Download https://deno.land/x/jose@v4.13.1/runtime/verify.ts
Download https://deno.land/x/jose@v4.13.1/lib/check_key_type.ts
Download https://deno.land/x/jose@v4.13.1/runtime/sign.ts
Download https://deno.land/x/jose@v4.13.1/runtime/encrypt.ts
Download https://deno.land/x/jose@v4.13.1/lib/iv.ts
Download https://deno.land/x/jose@v4.13.1/runtime/webcrypto.ts
Download https://deno.land/x/jose@v4.13.1/lib/invalid_key_input.ts
Download https://deno.land/x/jose@v4.13.1/runtime/is_key_like.ts
Download https://deno.land/x/jose@v4.13.1/runtime/digest.ts
Download https://deno.land/x/jose@v4.13.1/runtime/random.ts
Download https://deno.land/x/jose@v4.13.1/lib/format_pem.ts
Download https://deno.land/x/jose@v4.13.1/runtime/subtle_dsa.ts
Download https://deno.land/x/jose@v4.13.1/runtime/check_key_length.ts
Download https://deno.land/x/jose@v4.13.1/runtime/get_sign_verify_key.ts
Download https://deno.land/x/jose@v4.13.1/lib/check_iv_length.ts
Download https://deno.land/x/jose@v4.13.1/runtime/check_cek_length.ts
Download https://deno.land/x/jose@v4.13.1/lib/crypto_key.ts
Download https://deno.land/x/jose@v4.13.1/runtime/aeskw.ts
Download https://deno.land/x/jose@v4.13.1/runtime/ecdhes.ts
Download https://deno.land/x/jose@v4.13.1/runtime/pbes2kw.ts
Download https://deno.land/x/jose@v4.13.1/runtime/rsaes.ts
Download https://deno.land/x/jose@v4.13.1/lib/aesgcmkw.ts
Download https://deno.land/x/jose@v4.13.1/lib/epoch.ts
Download https://deno.land/x/jose@v4.13.1/lib/secs.ts
Download https://deno.land/x/jose@v4.13.1/runtime/timing_safe_equal.ts
Download https://deno.land/x/jose@v4.13.1/runtime/subtle_rsaes.ts
Download https://deno.land/x/jose@v4.13.1/runtime/bogus.ts
Download https://deno.land/x/jose@v4.13.1/lib/check_p2s.ts
Serving functions on http://localhost:54321/functions/v1/<function-name>
serving the request with /home/deno/functions/test
Download https://deno.land/std@0.168.0/http/server.ts
Download https://deno.land/x/postgres/mod.ts
Download https://deno.land/std@0.168.0/async/mod.ts
Download https://deno.land/std@0.168.0/async/abortable.ts
Download https://deno.land/std@0.168.0/async/deadline.ts
Download https://deno.land/std@0.168.0/async/debounce.ts
Download https://deno.land/std@0.168.0/async/deferred.ts
Download https://deno.land/std@0.168.0/async/delay.ts
Download https://deno.land/std@0.168.0/async/mux_async_iterator.ts
Download https://deno.land/std@0.168.0/async/pool.ts
Download https://deno.land/std@0.168.0/async/tee.ts
Download https://deno.land/std@0.168.0/async/retry.ts
Warning Implicitly using latest version (v0.17.2) for https://deno.land/x/postgres/mod.ts
Download https://deno.land/x/postgres@v0.17.2/mod.ts
Download https://deno.land/x/postgres@v0.17.2/client.ts
Download https://deno.land/x/postgres@v0.17.2/client/error.ts
Download https://deno.land/x/postgres@v0.17.2/pool.ts
Download https://deno.land/x/postgres@v0.17.2/query/transaction.ts
Download https://deno.land/x/postgres@v0.17.2/connection/connection.ts
Download https://deno.land/x/postgres@v0.17.2/connection/connection_params.ts
Download https://deno.land/x/postgres@v0.17.2/query/query.ts
Download https://deno.land/x/postgres@v0.17.2/utils/utils.ts
Download https://deno.land/x/postgres@v0.17.2/utils/deferred.ts
Download https://deno.land/x/postgres@v0.17.2/deps.ts
Download https://deno.land/x/postgres@v0.17.2/connection/packet.ts
Download https://deno.land/x/postgres@v0.17.2/connection/message.ts
Download https://deno.land/x/postgres@v0.17.2/connection/scram.ts
Download https://deno.land/x/postgres@v0.17.2/connection/message_code.ts
Download https://deno.land/x/postgres@v0.17.2/connection/auth.ts
Download https://deno.land/x/postgres@v0.17.2/query/encode.ts
Download https://deno.land/x/postgres@v0.17.2/query/decode.ts
Download https://deno.land/std@0.214.0/encoding/base64.ts
Download https://deno.land/std@0.214.0/encoding/hex.ts
Download https://deno.land/std@0.214.0/datetime/parse.ts
Download https://deno.land/std@0.214.0/io/buf_reader.ts
Download https://deno.land/std@0.214.0/io/buf_writer.ts
Download https://deno.land/std@0.214.0/bytes/copy.ts
Download https://deno.land/std@0.214.0/crypto/crypto.ts
Download https://deno.land/std@0.214.0/async/delay.ts
Download https://deno.land/std@0.214.0/fmt/colors.ts
Download https://deno.land/std@0.214.0/path/mod.ts
Download https://deno.land/x/postgres@v0.17.2/query/oid.ts
Download https://deno.land/x/postgres@v0.17.2/query/decoders.ts
Download https://deno.land/std@0.214.0/datetime/_common.ts
Download https://deno.land/std@0.214.0/path/windows/mod.ts
Download https://deno.land/std@0.214.0/path/posix/mod.ts
Download https://deno.land/std@0.214.0/path/constants.ts
Download https://deno.land/std@0.214.0/path/basename.ts
Download https://deno.land/std@0.214.0/path/dirname.ts
Download https://deno.land/std@0.214.0/path/extname.ts
Download https://deno.land/std@0.214.0/path/format.ts
Download https://deno.land/std@0.214.0/path/from_file_url.ts
Download https://deno.land/std@0.214.0/path/is_absolute.ts
Download https://deno.land/std@0.214.0/path/join.ts
Download https://deno.land/std@0.214.0/path/normalize.ts
Download https://deno.land/std@0.214.0/path/parse.ts
Download https://deno.land/std@0.214.0/path/relative.ts
Download https://deno.land/std@0.214.0/path/resolve.ts
Download https://deno.land/std@0.214.0/path/to_file_url.ts
Download https://deno.land/std@0.214.0/path/to_namespaced_path.ts
Download https://deno.land/std@0.214.0/path/common.ts
Download https://deno.land/std@0.214.0/path/separator.ts
Download https://deno.land/std@0.214.0/path/_interface.ts
Download https://deno.land/std@0.214.0/path/glob_to_regexp.ts
Download https://deno.land/std@0.214.0/path/is_glob.ts
Download https://deno.land/std@0.214.0/path/join_globs.ts
Download https://deno.land/std@0.214.0/path/normalize_glob.ts
Download https://deno.land/std@0.214.0/encoding/_util.ts
Download https://deno.land/std@0.214.0/assert/assert.ts
Download https://deno.land/std@0.214.0/crypto/_wasm/mod.ts
Download https://deno.land/std@0.214.0/crypto/_fnv/mod.ts
Download https://deno.land/x/postgres@v0.17.2/query/array_parser.ts
Download https://deno.land/std@0.214.0/path/windows/basename.ts
Download https://deno.land/std@0.214.0/path/windows/constants.ts
Download https://deno.land/std@0.214.0/path/windows/dirname.ts
Download https://deno.land/std@0.214.0/path/windows/extname.ts
Download https://deno.land/std@0.214.0/path/windows/format.ts
Download https://deno.land/std@0.214.0/path/windows/from_file_url.ts
Download https://deno.land/std@0.214.0/path/windows/is_absolute.ts
Download https://deno.land/std@0.214.0/path/windows/join.ts
Download https://deno.land/std@0.214.0/path/windows/normalize.ts
Download https://deno.land/std@0.214.0/path/windows/parse.ts
Download https://deno.land/std@0.214.0/path/windows/relative.ts
Download https://deno.land/std@0.214.0/path/windows/resolve.ts
Download https://deno.land/std@0.214.0/path/windows/to_file_url.ts
Download https://deno.land/std@0.214.0/path/windows/to_namespaced_path.ts
Download https://deno.land/std@0.214.0/path/windows/common.ts
Download https://deno.land/std@0.214.0/path/windows/separator.ts
Download https://deno.land/std@0.214.0/path/windows/glob_to_regexp.ts
Download https://deno.land/std@0.214.0/path/windows/is_glob.ts
Download https://deno.land/std@0.214.0/path/windows/join_globs.ts
Download https://deno.land/std@0.214.0/path/windows/normalize_glob.ts
Download https://deno.land/std@0.214.0/path/posix/basename.ts
Download https://deno.land/std@0.214.0/path/posix/constants.ts
Download https://deno.land/std@0.214.0/path/posix/dirname.ts
Download https://deno.land/std@0.214.0/path/posix/extname.ts
Download https://deno.land/std@0.214.0/path/posix/format.ts
Download https://deno.land/std@0.214.0/path/posix/from_file_url.ts
Download https://deno.land/std@0.214.0/path/posix/is_absolute.ts
Download https://deno.land/std@0.214.0/path/posix/join.ts
Download https://deno.land/std@0.214.0/path/posix/normalize.ts
Download https://deno.land/std@0.214.0/path/posix/parse.ts
Download https://deno.land/std@0.214.0/path/posix/relative.ts
Download https://deno.land/std@0.214.0/path/posix/resolve.ts
Download https://deno.land/std@0.214.0/path/posix/to_file_url.ts
Download https://deno.land/std@0.214.0/path/posix/to_namespaced_path.ts
Download https://deno.land/std@0.214.0/path/posix/common.ts
Download https://deno.land/std@0.214.0/path/posix/separator.ts
Download https://deno.land/std@0.214.0/path/posix/glob_to_regexp.ts
Download https://deno.land/std@0.214.0/path/posix/is_glob.ts
Download https://deno.land/std@0.214.0/path/posix/join_globs.ts
Download https://deno.land/std@0.214.0/path/posix/normalize_glob.ts
Download https://deno.land/std@0.214.0/path/_os.ts
Download https://deno.land/std@0.214.0/path/_common/common.ts
Download https://deno.land/std@0.214.0/assert/assertion_error.ts
Download https://deno.land/std@0.214.0/path/_common/constants.ts
Download https://deno.land/std@0.214.0/path/_common/strip_trailing_separators.ts
Download https://deno.land/std@0.214.0/path/_common/assert_path.ts
Download https://deno.land/std@0.214.0/path/posix/_util.ts
Download https://deno.land/std@0.214.0/crypto/_wasm/lib/deno_std_wasm_crypto.generated.mjs
Download https://deno.land/std@0.214.0/path/_common/from_file_url.ts
Download https://deno.land/std@0.214.0/crypto/_fnv/fnv32.ts
Download https://deno.land/std@0.214.0/crypto/_fnv/fnv64.ts
Download https://deno.land/std@0.214.0/path/_common/basename.ts
Download https://deno.land/std@0.214.0/path/windows/_util.ts
Download https://deno.land/std@0.214.0/path/_common/normalize_string.ts
Download https://deno.land/std@0.214.0/path/_common/to_file_url.ts
Download https://deno.land/std@0.214.0/path/_common/dirname.ts
Download https://deno.land/std@0.214.0/path/_common/normalize.ts
Download https://deno.land/std@0.214.0/path/_common/format.ts
Download https://deno.land/std@0.214.0/path/_common/relative.ts
Download https://deno.land/std@0.214.0/path/_common/glob_to_reg_exp.ts
Download https://deno.land/std@0.214.0/crypto/_fnv/util.ts
CPU time used: 197ms
Uncaught SyntaxError: The requested module './_wasm/mod.ts' does not provide an export named 'DigestAlgorithm'
at https://deno.land/std@0.214.0/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/std@0.182.0/http/server.ts:220:24)
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