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
@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": {}
}
}
}
}
Hi @Yatharth 👋 , how are you defining your baseURL?
I don't know where to define my base url
I am new to nuxt can you please help
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
it's there, do you have it defined in your .env ?
nope
can you give me an example env file?
or like what do define here?
this was already in the boilerplate code
which boilerplate?
can you share the link?
you can create a file with .env and inside write
yourdomain.com will be my backend server url right?
It will be the URL you use to access your store.
oh okay let me try
nope the issue still exists
can you create reproduction please?
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
https://github.com/vuestorefront/ecommerce-integration-boilerplate
I have used this integration
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...
I found it. 😄 What does your route look like?
route.js
I don't have a route.js file
it's in the template 🤔
ok even if I create this what do you think the issue is?
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?
I am simply creating .vue files inside pages directory and it automatically handles the routing for me
this is how my folder structure looks like
sorry for before this is the exact integration that I am using
https://github.dev/vuestorefront/ecommerce-integration-boilerplate
This has been archived
so can't I make it work somehow?
I'm sure it's possible. Just making sure you understand that it's archived
because when I started working it was not archived
Yes but I am like too deep into development here can't go back
got it. I'll try to help you either way.
let's start by upgrading the vsf modules:
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. 😄
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
that's progress of a sort 😄
check your api calls for a loose "api"
{
"api": {},
"config": {
"axios": {
"baseURL": "http://192.168.29.159:3000/api/api/",
"headers": {}
}
}
}
I am getting this inside my context object only
🤔 have you added an exrta api in the call somewhere ?
not anywhere I can find let me check anyways
it worked Thank you so much !!🙏
@rohrig
Great to hear 😄 , what was it you changed?
version only
😄 nice