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

297
Vistas
How to access the url that invoked my lambda function

I use the serverless framework to deploy my lambda functions. Serverless uses API Gateway to make my endpoints. I know that it's possible to pass the parameters in methods such as GET and use it in lambda by using the event object. The frontend is already deployed and they were using the following URL to call an endpoint:

example.com/api/EG43

`exports.myHandler = async function(event, context) {
        ...

        // somehow access the URL which was used by the frontend 
        // to grab that EG43 and then return the result based on that key.
        // return information to the caller.  
 }

which EG43 is a key that the previous backend was returning the result based on that key. My question is that if it's possible to somehow know what the URL is. the following doc from AWS shows the parameters that can be read by using the handler arguments, but it doesn't have URL.

https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html

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

0

You should be able to access these details two ways:

a. Setup a mapping template, and pass in the details you need as part of the payload. The mapping template is a velocity template with certain variables accessible. See this for details of what you can access.

b. You can setup the lambda in Proxy Integration mode. With this you have access to the raw request. See this for more details.

Here's how you should setup the Lambda in Proxy Integration Mode:

Lambda Proxy Integration Setup

And when the Lambda is setup in Proxy Integration way here's what you get in the event:

{
    "resource": "/abc/version/test",
    "path": "/abc/version/test",
    "httpMethod": "GET",
    "headers": null,
    "queryStringParameters": null,
    "pathParameters": null,
    "stageVariables": null,
    "requestContext": {
        "path": "/abc/version/test",
        "accountId": "1234",
        "resourceId": "resourceId",
        "stage": "Stage",
        "requestId": "AWS Request ID",
        "identity": {
            "cognitoIdentityPoolId": null,
            "cognitoIdentityId": null,
            "apiKey": "API Key",
            "cognitoAuthenticationType": null,
            "userArn": "arn:aws:iam::<acc_Id>:user/yogesh",
            "apiKeyId": "api-key-id",
            "userAgent": "aws-internal/3",
            "accountId": "<AccId>",
            "caller": "<Some caller ID>",
            "sourceIp": "test-invoke-source-ip",
            "accessKey": "<Access Key>",
            "cognitoAuthenticationProvider": null,
            "user": "<Some User Id>"
        },
        "resourcePath": "/abc/version/test",
        "httpMethod": "GET",
        "extendedRequestId": "test-invoke-extendedRequestId",
        "apiId": "API ID, is typically the API GW ID"
    },
    "body": null,
    "isBase64Encoded": false
}
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