janjaali / sendGrid-mock

SendGrid-Mock serves as a simple server mocking the sendgrid-apis for development purposes.
https://cloud.docker.com/repository/docker/ghashange/sendgrid-mock/general
MIT License
48 stars 19 forks source link

crypto.randomUUID is not a function #54

Closed donalmurtagh closed 1 year ago

donalmurtagh commented 1 year ago

After upgrading from v1.8.1 to v1.8.2, I get the following error in the container when processing an email request

TypeError: crypto.randomUUID is not a function
at /usr/src/server/src/server/ExpressApp.js:55:32
at Layer.handle [as handle_request] (/usr/src/server/node_modules/express/lib/router/layer.js:95:5)
at next (/usr/src/server/node_modules/express/lib/router/route.js:144:13)
at Route.dispatch (/usr/src/server/node_modules/express/lib/router/route.js:114:3)
at Layer.handle [as handle_request] (/usr/src/server/node_modules/express/lib/router/layer.js:95:5)
at /usr/src/server/node_modules/express/lib/router/index.js:284:15
at Function.process_params (/usr/src/server/node_modules/express/lib/router/index.js:346:12)
at next (/usr/src/server/node_modules/express/lib/router/index.js:280:10)
at /usr/src/server/node_modules/body-parser/lib/read.js:137:5
at AsyncResource.runInAsyncScope (async_hooks.js:198:9)

This causes a 500 response status code with the following body

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Internal Server Error</pre>
</body>
</html>

No such error occurs with v1.8.1.

janjaali commented 1 year ago

Oh I see, we are using different node versions for tests and builds. Unfortunately the node version used in build is 14.15.x. This version does not yet support crypto.randomUUID (see https://nodejs.org/api/crypto.html#cryptorandomuuidoptions).

janjaali commented 1 year ago

Fixed with https://github.com/janjaali/sendGrid-mock/releases/tag/v1.8.4.