Skip to content

paths #6

@peebles

Description

@peebles
    "serverless": "^4.15.1",
    "serverless-offline": "^14.4.0",
    "serverless-offline-lambda-function-urls": "^1.0.3",
service: portal-server
useDotenv: true

plugins:
  - serverless-offline
  - serverless-offline-lambda-function-urls

functions:
  backend:
    package:
      individually: true
      patterns:
        - '!**'
        - '.output/server/**'
    handler: .output/server/index.handler
    url: true
$ npx serverless offline start

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:
   * backend: portal-server-dev-backend

   ┌───────────────────────────────────────────────────────────────────────────┐
   │                                                                           │
   │   GET  | http://127.0.0.1:3003/dev/backend                                │
   │   POST | http://127.0.0.1:3003/2015-03-31/functions/backend/invocations   │
   │   POST | http://127.0.0.1:3003/dev/backend                                │
   │   POST | http://127.0.0.1:3003/2015-03-31/functions/backend/invocations   │
   │                                                                           │
   └───────────────────────────────────────────────────────────────────────────┘

Server ready: http://127.0.0.1:3003 🚀

So far so good.

curl http://localhost:3003/dev/backend

returns an index page as expected. But

$ curl http://localhost:3003/dev/backend/api/auth/ok
{"currentRoute":"get - /dev/backend/api/auth/ok","error":"Serverless-offline: route not found.","existingRoutes":["post - /dev/backend","get - /dev/backend"],"statusCode":404}

Shouldn't /dev/backend/* still be directed to the lambda function? This lambda function is a SPA backend with multiple routes. /api/auth/ok is a valid endpoint and should return something. In my serverless.yml, if I replace url mode with

    events:
      - http:
          path: /{proxy+}
          method: any

Then things work as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions