Open lilley2412 opened 2 years ago
Setting this to a Medium. If the work required to resolve this is determined to be larger than a medium, it should not be resolved as part of this work. Instead we'll need to re-scope and prioritize the work.
We found that regexRewrite does work in place of prefixRewrite:
options:
regexRewrite:
pattern:
regex: /my-path
substitution: "/"
Moving to the backlog
A customer is requesting this. I have tested it with 1.14.3 (service account and CLI creds) and the problems remains (following this installation guide : https://docs.solo.io/gloo-edge/latest/guides/traffic_management/destination_types/aws_lambda/eks-service-accounts/). Here is details of my (unsuccessful) local tests :
apiVersion: gateway.solo.io/v1
kind: VirtualService
metadata:
name: default
namespace: gloo-system
spec:
virtualHost:
domains:
- '*'
routes:
- matchers:
- prefix: /a/b/lambda
options:
prefixRewrite: /lambda
routeAction:
single:
destinationSpec:
aws:
logicalName: ati-lambda-test
unwrapAsApiGateway: true
wrapAsApiGateway: true
upstream:
name: lambda
namespace: gloo-system
My lambda function just returns the event (discovered by gloo) :
import json
def lambda_handler(event, context):
print(type(context))
return {
'statusCode': 200,
"headers": {
"Content-Type": "application/json"
},
'body': json.dumps({
"event": event
})
}
With prefixRewrite
and wrapAsApiGateway
:
With prefixRewrite
but without wrapAsApiGateway
:
With regexRewrite
and wrapAsApiGateway
:
I try several cases (playing with wrapAsApiGateway
and try the workaround regexRewrite
) but could not make it working. Sometimes we get 500
error, sometimes 404
and sometimes get the JSON back without the path change.
Given our current ordering of lambda we will either need to rework our entire setup to use router filter options along with lambda
This issue has been marked as stale because of no activity in the last 180 days. It will be closed in the next 180 days unless it is tagged "no stalebot" or other activity occurs.
Describe the bug
When a lambda upstream is used with options.prefixRewrite, the request results in an auth exception from aws lambda invoke. When prefixRewrite is removed, the request works regardless of what the route path is.
To Reproduce Steps to reproduce the behavior:
If the
prefixRewrite
is removed, the request succeeds.Expected behavior Prefix rewrite should not cause an authorization failure. If prefixRewrite is removed, and the route path is changed to
/
, it also works. Using rewrite should result in the same behavior.Additional context Add any other context about the problem here, e.g.