Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Sameer Ahmad
    @sameerAhmad9291

    Hi,

    Is there any way i can merge response from 2 api-services?

    Kamforka
    @Kamforka
    Hi people, is this project still alive?
    Malys
    @malys
    @Kamforka Follow my first thread searching @malys for the response.
    Jinul
    @Jinul
    Hey folks, Is there any way to set up inter API communication(different microservices) through the express-gateway with different authentication mechanism than policies defined for external routes?
    Kamforka
    @Kamforka
    @malys So it's indeed abandoned :( What a shame, I just wanted to adapt it as my main gateway service. I tried Ambassador and Tyk and neither of them offered as many features and a straightforward setup as EG did. Do you know any alternative with similar features like express-gateway?
    Vincenzo Chianese
    @XVincentX
    Ehehe people
    This is Vincenzo from Express Gateway — the project is a little bit neglected at the moment. As I said multiple times, the main reason is that the project did not get the traction I was expecting and more importantly no company stepped up to help its development (nor financially nor with developers) and the momentum went down
    I know it's a shame, but it is that it is. @Kamforka @malys
    Kamforka
    @Kamforka
    @XVincentX still thanks for the effort mate! I think this one is the most fun to use gateway out there!
    ravig-lakmiri
    @ravig-lakmiri
    Can someone pls help me with this issue "No suitable pipeline found" and also when I post a message I get a 404 back.. Disclaimer: I am new to express gateway..
    2020-03-28T02:20:04.382Z [EG:gateway] debug: mounting routes for apiEndpointName auth-email-confirm, mount /auth/email-confirm/:token
    2020-03-28T02:20:04.382Z [EG:gateway] debug: No suitable pipeline found for auth-email-confirm
    2020-03-28T02:20:04.382Z [EG:gateway] debug: methods specified, registering for each method individually
    2020-03-28T02:20:04.382Z [EG:gateway] debug: mounting routes for apiEndpointName auth-register-login, mount /auth/register-user
    2020-03-28T02:20:04.382Z [EG:gateway] debug: No suitable pipeline found for auth-register-login
    2020-03-28T02:20:04.382Z [EG:gateway] debug: methods specified, registering for each method individually
    2020-03-28T02:20:04.382Z [EG:gateway] debug: mounting routes for apiEndpointName auth-register-login, mount /auth/login
    2020-03-28T02:20:04.382Z [EG:gateway] debug: No suitable pipeline found for auth-register-login
    2020-03-28T02:20:04.382Z [EG:gateway] debug: methods specified, registering for each method individually
    2020-03-28T02:20:04.383Z [EG:gateway] debug: mounting routes for apiEndpointName auth-user, mount /auth/user
    2020-03-28T02:20:04.383Z [EG:gateway] debug: No suitable pipeline found for auth-user
    2020-03-28T02:20:04.383Z [EG:gateway] debug: no methods specified. handle all mode.
    2020-03-28T02:20:04.383Z [EG:gateway] debug: mounting routes for apiEndpointName properties, mount /property

    2020-03-28T02:20:04.383Z [EG:gateway] debug: No suitable pipeline found for properties
    2020-03-28T02:20:04.383Z [EG:gateway] debug: no methods specified. handle all mode.
    2020-03-28T02:20:04.383Z [EG:gateway] info: hot-reload config completed
    Here is my gateway.config.yml:
    http:
      port: 8080
    
    admin:
      host: localhost
      port: 9876
    
    apiEndpoints:
      auth-email-confirm:
        host: localhost
        path: '/auth/email-confirm/:token'
        methods: ["GET"]
    
      auth-register-login:
        host: localhost
        paths: ['/auth/register-user', '/auth/login']
        methods: ["POST"]
    
      auth-user:
        host: localhost
        path:  '/auth/user*'
    
      properties:
        host: localhost
        path: '/property*'
    
    serviceEndpoints:
      auth:
        url: 'http://localhost:3003'
    
      properties:
        url: 'http://localhost:4004'
    
    #policies to be used
    policies:
      - log
      - proxy
      - jwt
      - request-transformer
    
    #pipelines 
    pipelines:
      # this pipeline is used for user clicking on email confirmation
      authEmailConfirmPipeline: 
        apiEndPoints: 
          - auth-email-confirm
        policies:
          - log:
              action:
                message: '${req.method} ${req.originalUrl}'
          - proxy:
              action: 
                serviceEndpoint: auth
                changeOrigin: true
    
      # this pipeline is used for user registration or login apis
      authRegisterPipeline: 
        apiEndPoints: # in this case we dont need to validate the jwt
          - auth-register-login
        policies:
          - log:
              action:
                message: '${req.method} ${req.originalUrl}'  
          - proxy:
              action: 
                serviceEndpoint: auth
                changeOrigin: true
    
      # this pipeline is used for user logout or other user update functions (roles, privileges etc)
      authPipeline:
        apiEndpoints:
          - auth
        policies:
          - log:
              action:
                message: '${req.method} ${req.originalUrl}'
          - jwt:
              action:
                secretOrPublicKeyFile: ./.key/pubkey.pem
                checkCredentialExistence: false
          - proxy:
              action:
                serviceEndpoint: auth
                changeOrigin: true
    ravig-lakmiri
    @ravig-lakmiri
    When I POST the following using requests.rest in visual studio code, I get 404 error:
    POST http://localhost:8080/auth/register-user
    Content-Type: application/json
    
    {
        "username": "xyz@hotmail.com",
        "password": "adfj",
        "provider": "adf",
        "firstName": "adfads",
        "lastName": "asdfadsf",
        "middleName": "adsfa",
        "phones": [{"1123345678", "mobile"}]
    }
    Response:
    HTTP/1.1 404 Not Found
    Content-Type: text/plain; charset=utf-8
    Content-Length: 9
    ETag: W/"9-0gXL1ngzMqISxa6S1zx3F4wtLyg"
    Date: Sat, 28 Mar 2020 02:18:30 GMT
    Connection: close
    
    Not Found
    ravig-lakmiri
    @ravig-lakmiri
    Appreciate if anybody can help me with this?
    Sisir
    @prionkor
    I have a very basic question. How do I setup virutal host with EG?
    SS88
    @SS88
    @ravig-lakmiri you have to set serviceEndPoint auth-register-login as well
    SS88
    @SS88
    no api gateway project is actually well supported
    Ravi Solanki
    @YJHDRAVI123
    hello everyone , please can you suggest me any resource from the internet which have a demo to easily understand express-gateway.
    SS88
    @SS88
    the guy just told its a ghost project that it is no longer supported :)
    SS88
    @SS88
    @YJHDRAVI123 you could start with this one : https://www.youtube.com/watch?v=3GsV8MvB1ho
    ravig-lakmiri
    @ravig-lakmiri
    @SS88: Thanks for the response. .The second pipeline is for auth-register-login as shown below and it is already there in gateway.config.yml..
      # this pipeline is used for user registration or login apis
      authRegisterPipeline: 
        apiEndPoints: # in this case we dont need to validate the jwt
          - auth-register-login
        policies:
          - log:
              action:
                message: '${req.method} ${req.originalUrl}'  
          - proxy:
              action: 
                serviceEndpoint: auth
                changeOrigin: true
    Basically all 3 apiEndPoints are pointing to the same 'auth' serviceEndPoint
    ravig-lakmiri
    @ravig-lakmiri
    Can you pls tell me what am I doing wrong..
    SS88
    @SS88
    @ravig-lakmiri check the order of definition of apiendpoints and serviceendpoints and pipelines they should match
    ravig-lakmiri
    @ravig-lakmiri
    @SS88.. Thank you so much. Based on your clue, after a lot of experimentation, I finally figured it out.. Surprised that the gateway is so sensitive to how the config is defined..
    So, this works:
      pipeline0:
        apiEndPoints: 
          - authemailconfirm
        policies:
          - log:
              action:
                message: '${req.method} ${req.originalUrl}'
      pipeline1:
        apiEndPoints:
          - authregisterlogin
        policies:
          - log:
              action:
                message: '${req.method} ${req.originalUrl}'
      pipeline2:
        apiEndpoints:
          - authuser
        policies:
          - log:
              action:
                message: '${req.method} ${req.originalUrl}'
          - jwt:
              action: 
                secretOrPublicKeyFile: ./.key/pubkey.pem
                checkCredentialExistence: false
      pipeline3:
        apiEndpoints:
          - authemailconfirm
          - authregisterlogin  
          - authuser
        policies:
          - proxy:
              action:
                serviceEndpoint: authSvc
                changeOrigin: true
    ravig-lakmiri
    @ravig-lakmiri
    But this doesn't work.. surprise.. surprise..
    pipelines:
      pipeline0:
        apiEndPoints: 
          - authemailconfirm
        policies:
          - log:
              action:
                message: '${req.method} ${req.originalUrl}'
          - proxy:
              action:
                serviceEndpoint: authSvc
                changeOrigin: true
      pipeline1:
        apiEndPoints:
          - authregisterlogin
        policies:
          - log:
              action:
                message: '${req.method} ${req.originalUrl}'
          - proxy:
              action:
                serviceEndpoint: authSvc
                changeOrigin: true
      pipeline2:
        apiEndpoints:
          - authuser
        policies:
          - log:
              action:
                message: '${req.method} ${req.originalUrl}'
          - jwt:
              action: 
                secretOrPublicKeyFile: ./.key/pubkey.pem
                checkCredentialExistence: false
          - proxy:
              action:
                serviceEndpoint: authSvc
                changeOrigin: true
    The second one is how I wanted the structure of the pipelines to be.. Easy for reading as well.. But it gives error that 'No suitable pipeline found for authemailconfirm' and 'No suitable pripeline found for authregisterlogin'. It executes fine for authuser with the following message: 'executing pipeline for api authuser, mounted at /auth/user*'.
    Do you think it is a bug or the feature? The pattern I figured out is that each serviceEndpoint can only be part of one proxy policy and in one pipeline only.. Is that true? I dont think it was mentioned in the documentation anywhere
    SS88
    @SS88
    my question is how to retrieve "secretKey" based on a "username" from redis and pass it on to the gateway.config.yml ? (secretKey is not displayed as a redis value and equal to undefined) (secretKey is defined on eg credentials command execution) thanks for the help !
    Matt Essenburg
    @codersbrew
    Has anyone experienced 502s from the proxy policy? We seem to get READCONN reset every so often from services upstream in a kubernetes deployment.
    snekcz
    @snekcz
    @SS88 I'm not sure I understand fully what you want to achieve, but ... the user data are a bit spread in Redis among several EG-* keys. Anyway you can get to the user information including keys by following calls:
    smembers EG-username:<username>
    This will give you consumerId
    then call smembers EG-key-auth:<retrived consumerId>
    this will get you id, and finally call
    hgetall EG-key-auth:<id> to get credential data
    There might be also more efficient way of getting the data :-)
    ravig-lakmiri
    @ravig-lakmiri

    I have a different problem now. Though, the gateway is loading the pipelines properly, still gives a 404 error saying 'No pipeline matched, returning 404'. Part of gateway.config.yml below..

    apiEndpoints:
      authemailconfirm:
        host: 127.0.0.1
        paths: '/auth/email-confirm/:token'
        methods: ["GET"]
      authregisterlogin:
        host: 127.0.0.1
        paths: ['/auth/register-user', '/auth/login']
        methods: ["POST"]
      authuser:
        host: 127.0.0.1
        paths: ['/auth/user*']
    serviceEndpoints:
      authSvc:
          url: 'http://localhost:9000'
    policies:
      - basic-auth
      - log
      - cors
      - proxy
      - expression
      - key-auth
      - oauth2
      - rate-limit
      - jwt
    pipelines:
      default:
        policies:
        - log:
            action:
              message: '${req.method} ${req.originalUrl}'
      pipeline1:
        apiEndpoints:
          - authuser
        policies:
          - jwt:
              action: 
                secretOrPublicKeyFile: ./.key/pubkey.pem
                checkCredentialExistence: false
      pipeline2:
        apiEndpoints:
          - authemailconfirm
          - authregisterlogin  
          - authuser
        policies:
          - proxy:
              action:
                serviceEndpoint: authSvc
                changeOrigin: true

    I tried the apiEndPoint path with various options:

     '/auth/email-confirm*', '/auth/email*', '/auth/email-confirm/:token'.

    None of these work. Here is the requests.rest and the corresponding output.. Can anyone help pls..

    
    GET http://localhost:8449/auth/email-confirm/eyJhbGciOiJ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lkwm35q92FFqN2PNnzGtcFMun_hPR8cRmSXBG92Zh-g9RDqBXRqVYzxlQYzWdEYBRdN8eoIkDF670VMJjdKin86kzFaYxsPtcithPOm57rik2heQY3WQhyybENHOtjANr39wmoZ6ng
    HTTP/1.1 404 Not Found
    Content-Security-Policy: default-src 'none'
    X-Content-Type-Options: nosniff
    Content-Type: text/html; charset=utf-8
    Content-Length: 752
    Date: Tue, 31 Mar 2020 18:44:10 GMT
    Connection: close
    
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>Error</title>
    </head>
    <body>
    <pre>Cannot GET /auth/email-confirm/eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6Imd1cnNAaG90bWFpbC5jb20iLCJmaXJzdE5hbWUiOiJyYXZpIiwibGFzdE5hbWUiOiJndWR1cnUiLCJ1c2VyU3RhdHVzIjoidW5jb25maXJtZWQiLCJpYXQiOjE1ODU2Njc5ODIsImV4cCI6MTU4NTc1NDM4MiwiaXNzIjoiaHR0cDovL3JlbnRhdGVlei5jb20ifQ.es5SFjVMVG4nY7Iy-8qGEv4cJQUT8KSxbnn9sTfLZQo2GHD_HJRtxG5i5dZWLHhZgP7pvJtuteFQQL5ApB1TWw1qnUnvSbQ7AsFrpmMcbCNroyORKdFZgkyUlogVJ0lU1zQ5gb6bskGznHWIDhUnm_X5bE--8OBtvgBtgYRmilSA6YOC4zDuRSzAlBnpmRIx8wHX1D5Hx8EFlkwm35q92FFqN2PNnzGtcFMun_hPR8cRmSXBG92Zh-g9RDqBXRqVYzxlQYzWdEYBRdN8eoIkDF670VMJjdKin86kzFaYxsPtcithPOm57rik2heQY3WQhyybENHOtjANr39wmoZ6ng</pre>
    </body>
    </html>
    ravig-lakmiri
    @ravig-lakmiri
    Same problem with others as well.. For example: POST http://localhost:8449/auth/login gives the same error. Wonder am I the only one having this problem or this is not working for others as well? If it is the former, appreciate if anyone can point what I am doing wrong.
    ravig-lakmiri
    @ravig-lakmiri
    Can anyone suggest alternate gateways too? I am struggling with basic things in Express Gateway. May be I should try an easier and stable one first.
    SS88
    @SS88

    @snekcz I am passing to headers (under key-auth policy) the keyid:keysecret manually (under expression policy in the gateway.config.yml file) like this :

    req.headers["authorization"] = 'apiKey 1wEzbuNazXid27WxG8t8rL:6xSuwOsf1e4pUlunxEOKBL';

    and that, in order to access my apiendpoint through pasting the right url onto the browser. Now i want that process automatic : meaning i pass to the request headers keyId:keysecret of the logged user (i will have to get the userId first then retrieve the associated keys from redis)
    PS : i thought of .env file, meaning to add keyId and keysecret in a config file then add them into gateway.config.yml file through var env like this ${keyid}:${keysecret}.

    ravig-lakmiri
    @ravig-lakmiri
    @XVincentX or @snekcz can you pls help me with the above issue? I have not clue what is wrong with my gateway.config.yml
    SS88
    @SS88
    @ravig-lakmiri go with fast-gateway (an npm package)
    Matt Essenburg
    @codersbrew
    @SS88 is fast-gateway an express-gateway replacement?
    SS88
    @SS88
    @codersbrew of course NOT, i was just suggesting an alternative if someone finds express-gateway complex
    ravig-lakmiri
    @ravig-lakmiri
    Thank you @SS88. Really appreciate it. I will give it a try. Pls dont get me wrong. I like Express Gateway based on the adoption rate => there is more support in the community. But if the gateway is not behaving as it is supposed to and gives some cryptic error without explaining why, it becomes difficult. I am not an advanced developer. I am trying to learn and develop. But hitting so many hiccups at the beginning is frustrating. I raised a bug also. If you come across any error in my gateway.config.yml, pls let me know.. It is a learning moment for me. For now, I am switching to fast-gateway and give it a try. Thanks once again for the help.