serverless-wsgi icon indicating copy to clipboard operation
serverless-wsgi copied to clipboard

MethodView + Serverless Enterprise = GET only?

Open revmischa opened this issue 4 years ago • 3 comments

With sls enterprise enabled

@blp.route("")
class ThingsView(MethodView):
    @blp.arguments(ProvisionThingSchema, as_kwargs=True)
    @blp.response(ProvisionedThingSchema())
    def post(self, name: str):
        ....

@blp.route("/<string:thing_name>")
class ThingView(MethodView):
    @blp.arguments(SiteConfiguration)
    @blp.response()
    def patch(self, args: dict, thing_name: str):
        ....

    @blp.response()
    def delete(self, thing_name: str):
        ....

Check flask routes, looks fine:

❯ flask routes
Endpoint                     Methods        Rule
---------------------------  -------------  -------------------------------------
Monitoring.Monitoring        GET            /api/monitoring
Thing.ThingView              DELETE, PATCH  /api/thing/<string:thing_name>
Thing.ThingsView             POST           /api/thing

Check routes under sls wsgi flask local, the routes are only GET, not DELETE/PATCH:

❯ sls wsgi flask local --command routes
SERVERLESS_ENTERPRISE {"type": "transaction", "origin": "sls-agent", "payload": {"duration": 21.068811416625977, "endTime": "2020-03-26T12:20:51.634020Z", "logs": {}, "operationName": "s-transaction-function", "schemaType": "s-span", "schemaVersion": "0.0", "spanContext": {"spanId": "129d2eb3-8449-4e16-bf0e-2704f9e8a1fb", "traceId": "1234567890", "xTraceId": null}, ......., "requestId": "1234567890", "schemaVersion": "0.0", "timestamp": "2020-03-26T12:20:51.634020Z"}

[
    0,
    "Endpoint                     Methods  Rule\n---------------------------  -------  -------------------------------------
Monitoring.Monitoring        
GET      /api/monitoring\nThing.ThingView              
GET      /api/thing/<string:thing_name>\nThing.ThingsView    "
]

Now if I disable sls enterprise by commenting out app/org in my serverless.yml, all is well:

❯ sls wsgi flask local --command routes
Endpoint                     Methods        Rule
---------------------------  -------------  -------------------------------------
Monitoring.Monitoring        GET            /api/monitoring
Thing.ThingView              DELETE, PATCH  /api/thing/<string:thing_name>
Thing.ThingsView             POST           /api/thing

So something is really crazy between enterprise and wsgi.

revmischa avatar Mar 26 '20 12:03 revmischa

Yeah, I still haven't gotten around to dig into those Serverless Enterprise issues. Have you managed to get around #124, since you're now getting this new issue?

logandk avatar May 17 '20 19:05 logandk

I haven't yet, had to disable enterprise on some apps

revmischa avatar May 18 '20 07:05 revmischa

The issue is still present. Had to disable sls enterprise today to get my app working properly again

Dizzzmas avatar Jun 16 '20 13:06 Dizzzmas