Skip to content

Routes with autoAliases not considered for started #347

Open
@MichaelErmer

Description

@MichaelErmer

If a API gateway has a configuration using autoAliases, the service will be marker as "ready" (started) even if the routes are not registered yet:

name: "xyz",
routes: [{
    path: "/download",
    use: [cookieparser()],
    whitelist: ["xyz.download"],
    autoAliases: true,
    mappingPolicy: "restrict",
    logging: false,
}]
...
actions: {
    xyz: {
        rest: {
            method: "POST",
            path: "/"
        },
       ...
    }
}

If this syntax is used, it works as intended:

name: "xyz",
routes: [{
    path: "/download",
    use: [cookieparser()],
    whitelist: ["xyz.download"],
    aliases: {
        "POST /": "xyz.download"
    }
    mappingPolicy: "restrict",
    logging: false,
}]
...
actions: {
    download: {
        rest: {
            method: "POST",
            path: "/"
        },
       ...
    }
}

this test will randomly fail for the first case:

describe("test", () => {
    beforeAll(async () => {
        broker.createService(xyzService);
        await broker.start();
        await broker.waitForServices(["xyz"]);
    });
    // test to request /download
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions