issue with API call

When I do yarn start it adds undefined to my request url but when I do yarn dev it works fine. Can you guys help me with this issue?
35 Replies
Yatharth
YatharthOP2y ago
@skirianov @rohrig my config object makes this base url for yarn dev { "$bagisto": { "api": {}, "config": { "axios": { "baseURL": "http://192.168.29.159:3000/api/", "headers": {} } } } } and this for yarn start { "$bagisto": { "api": {}, "config": { "axios": { "baseURL": "undefined/api/", "headers": {} } } } }
rohrig
rohrig2y ago
Hi @Yatharth 👋 , how are you defining your baseURL?
Yatharth
YatharthOP2y ago
I don't know where to define my base url I am new to nuxt can you please help
Yatharth
YatharthOP2y ago
this is my nuxt.config file module.exports = { integrations: { bagisto: { location: '@vue-storefront/bagisto-api/server', configuration: { api: { url: 'https://bfd4-103-132-59-101.in.ngrok.io' // URL of your e-commerce platform } } } } }; and this is my middleware.config.js I am just providing my backend API endpoint here in middleware.config.js and it works when I do yarn dev but gives above issue when I do yarn start @rohrig
rohrig
rohrig2y ago
it's there, do you have it defined in your .env ?
Yatharth
YatharthOP2y ago
nope can you give me an example env file? or like what do define here? this was already in the boilerplate code
rohrig
rohrig2y ago
which boilerplate? can you share the link? you can create a file with .env and inside write
BASE_URL=yourDomain.com
BASE_URL=yourDomain.com
Yatharth
YatharthOP2y ago
yourdomain.com will be my backend server url right?
rohrig
rohrig2y ago
It will be the URL you use to access your store.
Yatharth
YatharthOP2y ago
oh okay let me try nope the issue still exists
rohrig
rohrig2y ago
can you create reproduction please?
Yatharth
YatharthOP2y ago
https://auction-dev.ycspl.in/ you can go to this website and when you go to marketplaces and then click weekly just check the network it will give an undefined in between the path
Vue Storefront
Build Setup
Yatharth
YatharthOP2y ago
GitHub
GitHub - vuestorefront/ecommerce-integration-boilerplate: Boilerpla...
Boilerplate for creating new integrations for Vue Storefront Next - open-source frontend for any eCommerce - GitHub - vuestorefront/ecommerce-integration-boilerplate: Boilerplate for creating new i...
rohrig
rohrig2y ago
I found it. 😄 What does your route look like? route.js
Yatharth
YatharthOP2y ago
I don't have a route.js file
rohrig
rohrig2y ago
it's in the template 🤔
Yatharth
YatharthOP2y ago
ok even if I create this what do you think the issue is?
rohrig
rohrig2y ago
I was thinking perhaps you have a var declared in the route that is undefined at runtime. How are you handling routing without the route file?
Yatharth
YatharthOP2y ago
I am simply creating .vue files inside pages directory and it automatically handles the routing for me
Yatharth
YatharthOP2y ago
this is how my folder structure looks like
Yatharth
YatharthOP2y ago
sorry for before this is the exact integration that I am using https://github.dev/vuestorefront/ecommerce-integration-boilerplate
rohrig
rohrig2y ago
This has been archived
Yatharth
YatharthOP2y ago
so can't I make it work somehow?
rohrig
rohrig2y ago
I'm sure it's possible. Just making sure you understand that it's archived
Yatharth
YatharthOP2y ago
because when I started working it was not archived Yes but I am like too deep into development here can't go back
rohrig
rohrig2y ago
got it. I'll try to help you either way. let's start by upgrading the vsf modules:
"@vue-storefront/middleware": "~2.5.4",
"@vue-storefront/nuxt": "~2.5.4",
"@vue-storefront/nuxt-theme": "~2.5.4",
"@vue-storefront/middleware": "~2.5.4",
"@vue-storefront/nuxt": "~2.5.4",
"@vue-storefront/nuxt-theme": "~2.5.4",
I think the current version is 2.7.5 there are a few places you need to update them. Go through each vue-storefront module to make sure they're on the latest version. For context, this has fix issues for others lately. That's why I'm starting with upgrading. 😄
Yatharth
YatharthOP2y ago
ok let me do this http://192.168.29.159:3000/api/api/bagisto/getProduct now instead of undefined I am getting two api/api like in above url
rohrig
rohrig2y ago
that's progress of a sort 😄 check your api calls for a loose "api"
Yatharth
YatharthOP2y ago
{ "api": {}, "config": { "axios": { "baseURL": "http://192.168.29.159:3000/api/api/", "headers": {} } } } I am getting this inside my context object only
rohrig
rohrig2y ago
🤔 have you added an exrta api in the call somewhere ?
Yatharth
YatharthOP2y ago
not anywhere I can find let me check anyways it worked Thank you so much !!🙏 @rohrig
rohrig
rohrig2y ago
Great to hear 😄 , what was it you changed?
Yatharth
YatharthOP2y ago
version only
rohrig
rohrig2y ago
😄 nice
Want results from more Discord servers?
Add your server