Estoy escribiendo un código en el óxido y compilándolo en wasm para ejecutarlo usando el tiempo de ejecución de node.js para lambda@edge. Necesito generar el uuid como parte de este código. Lo estoy haciendo en rust y el código se está compilando. Pero cuando ejecuto, arroja la siguiente excepción (y está en mi entorno local antes de implementar en lambda, por lo que no hay problema con el entorno de AWS)
panicked at 'could not retrieve random bytes for uuid: Node.js crypto module is unavailable', /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/uuid-0.8.2/src/v4.rs:31:13 Stack: Error at _.exports.__wbg_new_693216e109162396 (/Users/user/tech/DataPlatform/RustLambda/build.function/origin-request.js:1:3651) at wasm-function[124]:0x10671 at wasm-function[705]:0x21211 at wasm-function[223]:0x17ad0 at wasm-function[327]:0x1bc2e at wasm-function[521]:0x1ff7d at wasm-function[544]:0x20402 at wasm-function[445]:0x1e9c4 at wasm-function[303]:0x1ae09 at wasm-function[310]:0x1b1fd (node:36099) UnhandledPromiseRejectionWarning: RuntimeError: unreachable at wasm-function[223]:0x17b06 at wasm-function[327]:0x1bc2e at wasm-function[521]:0x1ff7d at wasm-function[544]:0x20402 at wasm-function[445]:0x1e9c4 at wasm-function[303]:0x1ae09 at wasm-function[310]:0x1b1fd at wasm-function[67]:0x59f1 at wasm-function[320]:0x1b80b at wasm-function[127]:0x10b8f (Use `node --trace-warnings ...` to show where the warning was created) (node:36099) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:36099) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.Aquí está mi fragmento de código en el óxido
let visitor_id = Uuid::new_v4(); debug_log!("visitor_id: {:#?}", visitor_id); }estoy usando uuid crate como
use uuid::Uuid;y las dependencias están aquí
uuid = { version = "0.8", features = ["v4", "wasm-bindgen"] } getrandom = { version = "0.2", features = ["js"] }¿Alguna idea de cómo proceder con la creación del UUID aquí?