dherault / serverless-offline

Emulate AWS λ and API Gateway locally when developing your Serverless project
MIT License
5.19k stars 796 forks source link

SLS_DEBUG doesn't show the exposed URL's in the console #1657

Open luanmuniz opened 1 year ago

luanmuniz commented 1 year ago

Bug Report

Current Behavior

As per the documentation, I expect to see the URL's for direct POST calls when using SLS_DEBUG=* But i don't.

This is the console:

$ SLS_DEBUG=* serverless offline --stage dev
Running "serverless" from node_modules

Starting Offline at stage dev (us-east-1)

Offline [http for lambda] listening on http://localhost:3002
Function names exposed for local invocation by aws-sdk:
           * function1: aws-node-project-dev-function1

When I run the command below, I will get the expected result from the lambda.

curl --request POST --url http://localhost:3002/2015-03-31/functions/aws-node-project-dev-function1/invocations

If I call the URL, I can use them, but I don't see them in the console. This is the starter code from serverless v3

Sample Code

service: aws-node-project
frameworkVersion: '3'

plugins:
  - serverless-offline

provider:
  name: aws
  runtime: nodejs18.x

functions:
  function1:
    handler: index.handler
module.exports.handler = async (event) => {
  return {
    statusCode: 200,
    body: JSON.stringify({
      message: 'Go Serverless v3.0! Your function executed successfully!',
      input: event,
    }, null, 2),
  };
};

Expected behavior/code

I expect to see these kinds of URLs in the console

           * invokedHandler: myServiceName-dev-invokedHandler
[offline] Lambda Invocation Routes (for AWS SDK or AWS CLI):
           * POST http://localhost:3002/2015-03-31/functions/myServiceName-dev-invokedHandler/invocations
[offline] Lambda Async Invocation Routes (for AWS SDK or AWS CLI):
           * POST http://localhost:3002/2014-11-13/functions/myServiceName-dev-invokedHandler/invoke-async/

Environment

Additional context/Screenshots

This is reproducible by creating a new blank project using the serverless framework and trying to run the command.