Serverless-offline: Doesn't parse {proxy+} routes

Created on 30 Nov 2016  路  10Comments  路  Source: dherault/serverless-offline

I'm using serverless to render server-side react and the {proxy+} route allows me to pass all of it through to the handler. This deploys and works as expected on AWS but fails with the offline plugin. Am I missing something?

sls offline
Serverless: Starting Offline: dev/us-east-1.

Serverless: Routes for frontend:
Serverless: ANY /
Serverless: ANY {proxy+}

  Error --------------------------------------------------

     Invalid path: /{proxy+}

     For debugging logs, run again after setting SLS_DEBUG env var.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues

     Please report this error. We think it might be a bug.

  Your Environment Information -----------------------------
     OS:                 darwin
     Node Version:       4.3.2
     Serverless Version: 1.2.1
bug

Most helpful comment

Mmm this is a real bug, I'll fix it and ship

All 10 comments

Hi @stephengfriend, I'll have a look at it

Can you tell me which serverless-offline version you are using?

@dherault 3.4.1

@stephengfriend What about 3.5.1? It should resolve your issue.

Updated to 3.5.1, different error now.

sls offline
Serverless: Starting Offline: dev/us-east-1.

Serverless: Routes for frontend:
Serverless: ANY /
Serverless: ANY /{proxy*}

  Error --------------------------------------------------

     New route /{p*} conflicts with existing /{proxy*}

     For debugging logs, run again after setting SLS_DEBUG env var.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues

     Please report this error. We think it might be a bug.

  Your Environment Information -----------------------------
     OS:                 darwin
     Node Version:       4.3.2
     Serverless Version: 1.2.1

My functions section is:

functions:
  frontend:
    handler: frontend/handler.render
    events:
      - http: ANY /
      - http: ANY {proxy+}

Mmm this is a real bug, I'll fix it and ship

If I remove the - http: ANY / I still get the same error. If I remove - http: ANY {proxy+} it launches, but going to localhost:3000/foo yields {"statusCode":404,"error":"Serverless-offline: route not found.","currentRoute":"get - /foo","existingRoutes":["* - /"]}. I'd expect a rendered 404 NotFound page from my handler.

Yes, the plugin has its own catch all route, I'll do something about it

Should be fixed in v3.5.2 :)

Confirmed! Thanks for the A+ support.

Was this page helpful?
0 / 5 - 0 ratings