This is my hook js file:
module.exports = {
n8n: {
ready: [
async function ({ app }, config) {
console.log('Running ready hook');
app.use(async (req, res, next) => {
console.log('I am in middleware');
});
},
],
},
};
But it never steps into the middleware function. The line console.log('I am in middleware'); is never reached. However, the line console.log('Running ready hook'); is reached.
My intention is to use the middleware to create a cookie when n8n starts. Can anybody help?
Information on your n8n setup
- n8n version: 1.104.1
- Database (default: SQLite): Postgres
- n8n EXECUTIONS_PROCESS setting (default: own, main): main
- Running n8n via (Docker, npm, n8n cloud, desktop app): Kubernetes
- Operating system: Ubuntu]