Middleware gets purged after API reload

Hi Jess,

thank you for your reply. Yes we’re still running version 2.2. Since I am still evaluating I can upgrade to 2.3. For potential productive use that might not be possible that easily anymore.

I tried your solution from the documentation and it does not seem to be loaded. I don’t have Tyk Pro so I guess that guide does not apply to my situation?

folder structure:

root@ee6c5d9ad0a0:/opt/tyk-gateway/middleware/06b81b75f51a4f5852721dd22b3b62fe/pre# ls
tokenInjection.js

and the middleware is just copied from the guide:

var tokenInjection = new TykJS.TykMiddleware.NewMiddleware({});
tokenInjection.NewProcessRequest(function(request, session) {

    log("This middleware does nothing, but will print this to your terminal.")

    // You MUST return both the request and session metadata
    return tokenInjection.ReturnData(request, session.meta_data);
});

edit:
I upgraded to Tyk 2.3. It is still not clear to me how I’m supposed to change the API definitions made from the Dashboard. I edited it straight in the database, is that the way to go? Because even though the definitions I changed in the database do not get removed now, I still can’t see any of the log statements from the middleware.