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

Any way to deactivate http-proxy ?

Open erwan-joly opened this issue 2 years ago • 1 comments

I'm searching for a way to deactivate http-proxy on dev. So http proxy do not seems to work for my resources in serverless offline so i turned resourceRoutes to false. My idea is my lambda is actually going to serve the right data but on dev only. Unfortunately it only works if i comment out the events or else i get conflicting routes...

image

My current way to deal with this is to comment the code and get my ci/cd to uncomment it... That's pretty ugly. I'm wondering if there is anyway to make it works without comments ?

erwan-joly avatar Mar 10 '23 05:03 erwan-joly

Something like that will probably work:

plugins:
  - serverless-plugin-ifelse

custom:
  serverlessIfElse:
    - If: '"${env:IS_OFFLINE, "0"}" == "1"'
      Exclude:
        - functions.marketracoon-spa.events[0]
        - functions.marketracoon-spa.events[1]
        - functions.marketracoon-spa.events[2]

needs IS_OFFLINE=1 sls offline start

pkit avatar Mar 01 '24 21:03 pkit