Skip to content

UI: setOktaCookieinClients is undefined in clients.js #3265

@gjoranv

Description

@gjoranv

Summary

The UI fails with ReferenceError: setOktaCookieinClients is not defined when handling any request. The function is called unconditionally in src/server/clients.js:107 in the middleware:

req.clients = {
    zms: CLIENTS.zms(req, setCookieinClients(req)),
    msd: CLIENTS.msd(req, setCookieinClients(req)),
    zts: CLIENTS.zts(req, setCookieinClients(req)),
    ums: CLIENTS.ums(req, setCookieinClients(req)),
    cloud_sso: CLIENTS.cloud_sso(req, setOktaCookieinClients(req)),
};

setCookieinClients is defined in the same file, but setOktaCookieinClients is not. It appears to be a Yahoo-internal function that was not included in the open-source release.

The callCloudSSO config flag in default-config.js only guards usage in api.js, not the client middleware creation.

Workaround

Define a stub before the middleware export:

function setOktaCookieinClients(req) {
    return setCookieinClients(req);
}

Suggested fix

Either include setOktaCookieinClients in the open-source code, or guard the cloud_sso client creation with a config check (e.g. only create it when callCloudSSO is true).

Version

v1.12.36

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