A
Alokaiβ€’14mo ago
valerii.f

Problems using Custom Integration

Hello! I am writing custom integration using boilerplate npx @vue-storefront/cli create integration everything configured as per documentation, added endpoints - and it works fine with playground πŸ™‚ And now I want to use it to connect to some demo application based on https://github.com/vuestorefront/storefront-next13-boilerplate/tree/develop And i need help here, it seems I am missing something, which doesn't let me start the middleware. Here is what I did so far. I built the middleware sdk: inside integration application -> packages/sdk -> run yarn build as a result I got the lib folder, which I copy into my Next.js application In the Next.js application I updated middleware.config.js with configuration and location: '@vue-storefront/integration-boilerplate-api/server' -> which looks weird to me, but that is another question. when trying to run middleware application getting error:
β„Ή Middleware starting....
β„Ή Loading integrations...
β„Ή - Loading: nochannelApi @vue-storefront/integration-boilerplate-api/server

ERROR Cannot find module '@vue-storefront/integration-boilerplate-api/server'
Require stack:
- /vsf-ui/integration/node_modules/@vue-storefront/middleware/lib/index.cjs.js
- /vsf-ui/integration/middleware.js

Require stack:
- node_modules/@vue-storefront/middleware/lib/index.cjs.js
- middleware.js
β„Ή Middleware starting....
β„Ή Loading integrations...
β„Ή - Loading: nochannelApi @vue-storefront/integration-boilerplate-api/server

ERROR Cannot find module '@vue-storefront/integration-boilerplate-api/server'
Require stack:
- /vsf-ui/integration/node_modules/@vue-storefront/middleware/lib/index.cjs.js
- /vsf-ui/integration/middleware.js

Require stack:
- node_modules/@vue-storefront/middleware/lib/index.cjs.js
- middleware.js
Could you please help me to understand what exactly am I doing wrong ? πŸ₯Ή πŸ™
GitHub
GitHub - vuestorefront/storefront-next13-boilerplate: Vue Storefron...
Vue Storefront Next 13 Boilerplate. Contribute to vuestorefront/storefront-next13-boilerplate development by creating an account on GitHub.
8 Replies
Fabrice Reynaud
Fabrice Reynaudβ€’14mo ago
Hello, if you import the module like that I think maybe you need to use yarn link from the integration boilerplate project in order for the next project to see that dependency?
valerii.f
valerii.fOPβ€’14mo ago
@Fabrice Reynaud thanks, but I am not sure I understand everything πŸ™‚ could you please clarify this "use yarn link" ? I thought building the Integration - i should get everything I need to be able to use in ANY frontend framework πŸ™‚ but this ERROR Cannot find module '@vue-storefront/integration-boilerplate-api/server' doesn't give me this impression anymore 😦
Fabrice Reynaud
Fabrice Reynaudβ€’14mo ago
Ah sorry you said you copied the lib folder into the Next project, so no need to use yarn link between the two projects, then maybe you need to import it using a path to the lib folder instead of the package name? I think the module "@vue-storefront/integration-boilerplate-api/server" isn't known in the frontend app because it was build in the integration app, but it should work if you just import the folder I think. Again I'm just starting to play with this framework so I hope maybe someone more knowledgeable than me will be able to help you πŸ™‚
valerii.f
valerii.fOPβ€’14mo ago
Same, starting with this project πŸ™‚ and having problems πŸ™‚
Fabrice Reynaud
Fabrice Reynaudβ€’14mo ago
Well like I said in my case I didn't import the middleware in the Next project but just ran the server directly from the integration boilerplate project with "yarn dev". However I did try to import the SDK from the integration boilerplate into the Next app without using "yarn link" but instead using in package.json (this would be the name and the path of the middleware for you): "dependencies": { "@vue-storefront/integration-boilerplate-sdk": "portal:/var/www/sdk/packages/sdk", And then: import { boilerplateModule, BoilerplateModuleType } from '@vue-storefront/integration-boilerplate-sdk';
valerii.f
valerii.fOPβ€’14mo ago
OK, the problem was that I didn't include all built files from api-client folder
skirianov
skirianovβ€’14mo ago
Thanks @Fabrice Reynaud ❀️
JDRBoost
JDRBoostβ€’8mo ago
Hi @Fabrice Reynaud @valerii.f, can I ask any of you for some help. I am trying to achieve a similar setup but using nuxt. How did you connect the sdk config? My defineSdkConfig function inside my playground seems to differ from the defineSdkConfig function inside the nuxt boilerplate project
Want results from more Discord servers?
Add your server