n1ru4l
10/26/2022, 7:50 AMError: This function should only be called through the recipe object
err: Error: This function should only be called through the recipe object
at Object._call (/Users/laurinquast/Projects/graphql-hive-2/node_modules/supertokens-js-override/lib/build/getProxyObject.js:17:19)
at Object.ret.<computed> [as authorisationUrlGET] (/Users/laurinquast/Projects/graphql-hive-2/node_modules/supertokens-js-override/lib/build/getProxyObject.js:27:29)
at Object.authorisationUrlGET (webpack-internal:///(api)/./src/lib/supertokens/third-party-email-password-node-oidc-provider.ts:103:45)
While trying to compose multiple overrides using a helper function (so code can be isolated).n1ru4l
10/26/2022, 7:50 AMconst composeSuperTokensOverrides = (overrides: Array<ThirdPartEmailPasswordTypeInput['override'] | null>) => ({
apis: (
originalImplementation: ReturnType<
Exclude<Exclude<ThirdPartEmailPasswordTypeInput['override'], undefined>['apis'], undefined>
>,
builder: OverrideableBuilder<ThirdPartyEmailPasswordNode.APIInterface> | undefined
) => {
let impl = originalImplementation;
for (const override of overrides) {
if (typeof override?.apis === 'function') {
impl = override.apis(impl, builder);
}
}
return impl;
},
functions: (
originalImplementation: ReturnType<
Exclude<Exclude<ThirdPartEmailPasswordTypeInput['override'], undefined>['functions'], undefined>
>
) => {
let impl = originalImplementation;
for (const override of overrides) {
if (typeof override?.functions === 'function') {
impl = override.functions(impl);
}
}
return impl;
},
});
And this is the actual usage:
override: composeSuperTokensOverrides([
getEnsureUserOverrides(internalApi),
env.auth.organizationOIDC ? getOIDCThirdPartyEmailPasswordNodeOverrides({ internalApi }) : null,
/**
* These overrides are only relevant for the legacy Auth0 -> SuperTokens migration (period).
*/
env.auth.legacyAuth0 ? getAuth0Overrides(env.auth.legacyAuth0) : null,
]),
Any quick ideas?n1ru4l
10/26/2022, 7:58 AMrp_st
10/26/2022, 8:10 AMrp_st
10/26/2022, 8:10 AMporcellus
10/26/2022, 4:16 PMporcellus
10/26/2022, 4:17 PMporcellus
10/26/2022, 4:18 PMporcellus
10/26/2022, 4:20 PMn1ru4l
10/27/2022, 8:30 AMporcellus
10/27/2022, 8:41 AMbuilder.override(overrideFunc)
where overrideFunc in your case is override.functions
or override.apis