Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

1.2K
Vistas
AWS Lambda - Error: Cannot find module 'uuid/v4'

I am receiving this Error when trying to use UUID Module in AWS Lambda JavaScript code.

Error: Cannot find module 'uuid/v4'

I am not using AWSCLI or NPM, i am instead using the AWS Lambda dashboard to author the Lambda Functions in JavaScript.

const AWS = require('aws-sdk');
const AWSUUID = require('uuid/v4');
const AWSGamelift = new AWS.GameLift();

exports.handler = async (event) => 
{
 //...

Ive been searching Google nonstop trying to find a way to get the UUID Module to work. I do not want to have to setup and use an NPM environment.

Is there some method on the AWS Lambda dashboard to provide access to the UUID Module for Lambda code?

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

You need to install uuid package. uuid recently did a breaking change, the way you use it. New way is

const {"v4": uuidv4} = require('uuid');

Hope this helps.

over 4 years ago · Santiago Trujillo Denunciar

0

AWS Lambda Layers is an option for this if we don't want to set up any npm environment.

Create a new layer for your Lambda function from the AWS console and upload the zip file from the node_modules directory that contains the uuid npm package.

A few things to remember to get this working:

  1. The directory structure should be kept as per the AWS documentation https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html#configuration-layers-path

enter image description here

This is important, otherwise the Lambda function will not recognize the packages.

  1. Your Lambda function's IAM role must have the lambda:GetLayerVersion action permission, otherwise you'll run into a problem with the missing package. This is clearly explained in the documentation mentioned above.

Once done, you can run your code. response example

enter image description here

The nodejs folder structure is as follows

enter image description here

over 4 years ago · Santiago Trujillo Denunciar

0

navigate to that file, and look around line number 3 in node_modules/expo-constants/exponentConstants.web.js

import uuidv4 from 'uuid/v4

and change it to:

import {v4 as uuidv4} from 'uuid';

This error happens because of the file structure in node_modules/uuid, if you look there is no longer a uuidv4 to import and instead they export a v4. You could change all the places where the developers wrote uuidv4 to v4 but using the { this as that } syntax you don't have to rewrite a bunch of code.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda