A
Alokai•7mo ago
CCavelier

buildModule with updated package

i want integrate magento with nuxt3 boiler plate i've updated dependencies, now i've error on buildModule(middlewareModule<Endpoints>,{...}

No overload matches this call.
web:dev: Overload 1 of 2, '(module: ModuleInitializerWithMandatoryOptions<{ connector: Methods<WithoutContext<typeof import("~/storefront-nuxt3-boilerplate/node_modules/@vue-storefront/magento-api/lib/api/index")>>; context: { ...; }; }, Options<...>>, moduleOptions: Options<...>, extension?: object | ... 1 more ... | undefined, extensionOptions?: object | undefined): { ...; } & object', gave the following error.

No overload matches this call.
web:dev: Overload 1 of 2, '(module: ModuleInitializerWithMandatoryOptions<{ connector: Methods<WithoutContext<typeof import("~/storefront-nuxt3-boilerplate/node_modules/@vue-storefront/magento-api/lib/api/index")>>; context: { ...; }; }, Options<...>>, moduleOptions: Options<...>, extension?: object | ... 1 more ... | undefined, extensionOptions?: object | undefined): { ...; } & object', gave the following error.
if i create customQueries in middleware, i've compilation error
middleware.config.ts(18,39): error TS7031: Binding element 'variables' implicitly has an 'any' type.
middleware.config.ts(18,39): error TS7031: Binding element 'variables' implicitly has an 'any' type.
can you help me. Thanks
5 Replies
rohrig
rohrig•7mo ago
Please update to the latest version and follow the docs here: https://docs.alokai.com/integrations/magento If you're still having the issue please let us know 🙂
Alokai
Magento 2 SDK
Quickly build your storefront with the Alokai SDK for Magento. Connect your Magento 2 backend to any frontend framework with type-safe SDK methods
Darren R
Darren R•7mo ago
@CCavelier That overload error is because the BuildModule options expects a value for cdnCacheBustingId If you add it that error will resolve.
magento: buildModule(middlewareModule<Endpoints>, {
apiUrl: 'http://localhost:8181/magento',
cdnCacheBustingId: 'your-cdn-cache-busting-id',
}),

magento: buildModule(middlewareModule<Endpoints>, {
apiUrl: 'http://localhost:8181/magento',
cdnCacheBustingId: 'your-cdn-cache-busting-id',
}),

CCavelier
CCavelierOP•7mo ago
export default defineSdkConfig(
({ buildModule, middlewareModule, middlewareUrl, getRequestHeaders }:any) => ({
commerce: buildModule<SdkModule>(sdkModule),
magento: buildModule(middlewareModule<Endpoints> , {
apiUrl: middlewareUrl+"/magento",
cdnCacheBustingId:process.env.CDN_CACHE_BUSTING_ID,
defaultRequestConfig: {
headers: getRequestHeaders(),
},
})
})
);
export default defineSdkConfig(
({ buildModule, middlewareModule, middlewareUrl, getRequestHeaders }:any) => ({
commerce: buildModule<SdkModule>(sdkModule),
magento: buildModule(middlewareModule<Endpoints> , {
apiUrl: middlewareUrl+"/magento",
cdnCacheBustingId:process.env.CDN_CACHE_BUSTING_ID,
defaultRequestConfig: {
headers: getRequestHeaders(),
},
})
})
);
i've already this entry error is 'SdkModuleOptions' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled. in generate file : import { SdkModuleOptions } from "./vsfModule"; was import... Type 'any' has no signatures for which the type argument list is applicable. for -> <Endpoints> Untyped function calls may not accept type arguments. for line -> commerce: buildModule<SdkModule>(sdkModule),
Darren R
Darren R•7mo ago
To fix that import error you need to import as type import type { SdkModuleOptions } from "./vsfModule"
cyril.cavelier
cyril.cavelier•7mo ago
yes but the import was added to the compilation, and for other errors
Want results from more Discord servers?
Add your server