Giter VIP home page Giter VIP logo

Comments (5)

mohammedsahl avatar mohammedsahl commented on June 1, 2024 1

Facing the same issue as well. My team wasn't keen on messing with the greedy path variable names since that would entail a relatively uncomfortable change in API Gateway. Our routes are well established and running well.

Another quick workaround is to delete event.pathParameters.proxy if it exists and pass the edited event into serverlessExpress. This way util.js is forced to use event.path.

from serverless-express.

pocketcowboy avatar pocketcowboy commented on June 1, 2024

Offending line is https://github.com/vendia/serverless-express/blob/0909ec4ffd09d9fd22538257b721b7d076d03732/src/event-sources/utils.js#LL7C21-L7C21

A quick workaround is to change the name of the greedy path variable in API Gateway e.g. rename {proxy+} to {route+}.

from serverless-express.

hisham avatar hisham commented on June 1, 2024

To add to @mohammedsahl comment - vendia v4 does not seem to be compatible with how AWS Amplify sets up REST endpoints in API Gateway (https://docs.amplify.aws/cli/restapi/restapi/#create-a-rest-api). Since AWS Amplify allows for varying auth levels per endpoint, and the auth checks are done by API Gateway, it uses /foo/{proxy+} rather than /{proxy+}.

To make this lib work with amplify, you have to do what @mohammedsahl describes in #648 (comment) or similar.

from serverless-express.

brett-vendia avatar brett-vendia commented on June 1, 2024

Can you try the v5 branch #649? We'll merge this after additional verification

from serverless-express.

mohammedsahl avatar mohammedsahl commented on June 1, 2024

Hey @brett-vendia. Unfortunately, it still doesn't seem to work. This event.multiValueQueryStringParameters in our event is null and so the params passed to to url.format() are { pathname: '/<somePathParamter>', query: null }

If it helps our event has the following structure

{
  "resource": "/foo/{proxy+}",
  "path": "/foo/<PathParamter>",
  ...
  "queryStringParameters": null,
  "multiValueQueryStringParameters": null,
  "pathParameters": {
    "proxy": "<PathParamter>"
  },
  ...
}

from serverless-express.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.