Using Corredor trigger with request.path

Hello All:

Getting started with Corteza and looking to avoid building third-party middleware and instead using Corredor to handle certain functions (i.e., I need to validate a HMAC-SHA-256 signature in a HTTP header for an incoming webhook).

I’ve installed Corteza (monolith) and Corredor server and both seem to be communicating fine. I see the script in the Corteza admin panel and the trigger looks correct. But I must be missing something because a simple cURL call to the path doesn’t seem to be doing anything, and if I try in the browser, I get redirected as though it doesn’t exist. Wondering if someone can help me craft an appropriate call or point me in the direction of some other configuration I may be missing?

import base64 from 'base-64'


export default {
    label: "TestPath",
    description: "Used to test a path",

    security: {
        runAs: 'someUser',
    },

    // When POST request on a certain path is recieved
    triggers ({ on }) {
    return on('request')
        .where('request.path', '/some/path/here')
        // HTTP protocol; GET, POST, PUT, PATCH, DELETE
        .where('request.method', 'GET')
        .for('system:sink')
    },

    // remove async if you aren't doing any async operations
    // use object destructuring for args and ctx
    async exec({ $request, $response }) {
        // Code goes here
        console.log('howdy')

        // const body = JSON.parse(base64.decode($request.rawBody))
        const body = JSON.parse(Buffer.from($request.rawBody,'base64'))
        $response.status = 200
        $response.header = { 'Content-Type': ['application/json'] }
        $response.body = JSON.stringify({ result: 'example response from test path' })

        // and send back everything
        return $response
    },
  }

The docs below might be able to help. I think you might be missing a signature

Got it (I think). So, it does require the sink path and is not just a base path that you specify in the server script trigger (e.g., $BASE_API_URL/system/sink/ instead of $BASE_API_URL/)?

It should be just the path after the /sink but can’t remember how trailing/leading slashes are. Best to try a few combinations. Feel free to update us here so we can update the docs