szobi
szobi
NNuxt
Created by szobi on 7/10/2024 in #❓・help
Problem with envs in docker
Helllo, l have a problem with envs to redis connect l hosted app in docker with custom image its my nuxt.config
runtimeConfig: {
redisHost: '',
redisPort: '',
redisPassword: '',
redisUsername: '',
runtimeConfig: {
redisHost: '',
redisPort: '',
redisPassword: '',
redisUsername: '',
server/plugins/storage.ts
import redisDriver from 'unstorage/drivers/redis'

export default defineNitroPlugin(() => {

const config = useRuntimeConfig()
console.log(config)
const storage = useStorage()
const driver = redisDriver({
base: '',
host: config.redisHost,
// @ts-ignore set REDIS_PORT AS number
port: config.redisPort as number,
username: config.redisUsername,
password: config.redisPassword,

})

// Mount driver
storage.mount('redis', driver)
})
import redisDriver from 'unstorage/drivers/redis'

export default defineNitroPlugin(() => {

const config = useRuntimeConfig()
console.log(config)
const storage = useStorage()
const driver = redisDriver({
base: '',
host: config.redisHost,
// @ts-ignore set REDIS_PORT AS number
port: config.redisPort as number,
username: config.redisUsername,
password: config.redisPassword,

})

// Mount driver
storage.mount('redis', driver)
})
But after docker compose up app see only envs from runTime.public redisHost and others are empty 😦 and redis want connect to default 127.0.0.1 server any ideas?
2 replies
NNuxt
Created by szobi on 4/12/2024 in #❓・help
custom modules i n Nuxt Layers
Hi, I am creating a layer that will be used in many projects. In the layer I have three modules that are responsible for, for example, syncing snippets from the backend, in general, a lot of it is based on folders and files. (modules are in the local modules folder) I have a problem because when I extend in the main project where I use this layer, it shows me that this module is missing. Is it possible to play it somehow or do the modules have to be as separate packages?
2 replies
NNuxt
Created by szobi on 9/21/2023 in #❓・help
I18n change translations
Hello, Is it possible to change translations on the fly without rebuild app? l want a sync a snippets from admin panel, lm using nuxt-i18n
5 replies
NNuxt
Created by szobi on 5/9/2023 in #❓・help
error with nuxi upgrade using pnpm
Hello, l want to upgrade nuxt to the latest version but with pnpm l have that problem:
pnpm dlx nuxi upgrade
.../share/pnpm/store/v3/tmp/dlx-81284 | +1 +
.../share/pnpm/store/v3/tmp/dlx-81284 | Progress: resolved 2, reused 0, downloaded 1, added 0
Nuxi 3.4.3 1:12:01 PM
1:12:01 PM
ℹ Package Manager: pnpm 8.2.0 1:12:01 PM
ℹ Current nuxt version: 3.3.2 1:12:01 PM
.../share/pnpm/store/v3/tmp/dlx-81284 | Progress: resolved 2, reused 0, downloaded 1, added 1, done 1:12:01 PM
 ERR_PNPM_ADDING_TO_ROOT  Running this command will add the dependency to the workspace root, which might not be what you want - if you really meant it, make it explicit by running this command again with the -w flag (or --workspace-root). If you don't want to see this warning anymore, you may set the ignore-workspace-root-check setting to true.

ERROR Command failed: pnpm install -D nuxt
pnpm dlx nuxi upgrade
.../share/pnpm/store/v3/tmp/dlx-81284 | +1 +
.../share/pnpm/store/v3/tmp/dlx-81284 | Progress: resolved 2, reused 0, downloaded 1, added 0
Nuxi 3.4.3 1:12:01 PM
1:12:01 PM
ℹ Package Manager: pnpm 8.2.0 1:12:01 PM
ℹ Current nuxt version: 3.3.2 1:12:01 PM
.../share/pnpm/store/v3/tmp/dlx-81284 | Progress: resolved 2, reused 0, downloaded 1, added 1, done 1:12:01 PM
 ERR_PNPM_ADDING_TO_ROOT  Running this command will add the dependency to the workspace root, which might not be what you want - if you really meant it, make it explicit by running this command again with the -w flag (or --workspace-root). If you don't want to see this warning anymore, you may set the ignore-workspace-root-check setting to true.

ERROR Command failed: pnpm install -D nuxt
any ideas?
npx nuxi upgrade doesnt work too
3 replies
NNuxt
Created by szobi on 3/28/2023 in #❓・help
nuxt instance unavailable during fetch data
after ugrade from 3.0.0 to 3.3.2 l have a problem with fetch data in pinia store ( lm using setup store type) trackbase
Error: nuxt instance unavailable 16:55:33
at Module.useNuxtApp (/home/szobi/code/1-front/node_modules/nuxt/dist/app/nuxt.js:189:13)
at Module.useAppConfig (/home/szobi/code/1-front/node_modules/nuxt/dist/app/config.js:32:41)
at getProductOpinion (/home/szobi/code/1-front/stores/products.ts:62:56)
at Proxy.getProduct (/home/szobi/code/1-front/stores/products.ts:42:13)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async setup (/home/szobi/code/1-front/pages/product/[slug].vue:90:164)
Error: nuxt instance unavailable 16:55:33
at Module.useNuxtApp (/home/szobi/code/1-front/node_modules/nuxt/dist/app/nuxt.js:189:13)
at Module.useAppConfig (/home/szobi/code/1-front/node_modules/nuxt/dist/app/config.js:32:41)
at getProductOpinion (/home/szobi/code/1-front/stores/products.ts:62:56)
at Proxy.getProduct (/home/szobi/code/1-front/stores/products.ts:42:13)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async setup (/home/szobi/code/1-front/pages/product/[slug].vue:90:164)
its my pages code:
[slug].vlue
try {
await productStore.getProduct(route.params.slug, EProductType.SINGLE)
} catch (e) {
showError({ statusCode: EErrorStatus.ERROR_404, statusMessage: 'Pages Not Found' })
}
[slug].vlue
try {
await productStore.getProduct(route.params.slug, EProductType.SINGLE)
} catch (e) {
showError({ statusCode: EErrorStatus.ERROR_404, statusMessage: 'Pages Not Found' })
}
method in pinia:
const getProduct = async (
slug: string | number,
expectedType: EProductType,
options: CustomFetchOptions | null = null,
) => {
const { $sdk } = useNuxtApp()
opinions.value = []

try {
const response = await $sdk.api.products(
options || {
query: { slug },
},
)
product.value = response.data
if (product.value?.type !== expectedType) {
throw new Error('Product type is not expected ')
}

await getProductOpinion()
} catch (err) {
errorHandler(err)
}
}
const getProduct = async (
slug: string | number,
expectedType: EProductType,
options: CustomFetchOptions | null = null,
) => {
const { $sdk } = useNuxtApp()
opinions.value = []

try {
const response = await $sdk.api.products(
options || {
query: { slug },
},
)
product.value = response.data
if (product.value?.type !== expectedType) {
throw new Error('Product type is not expected ')
}

await getProductOpinion()
} catch (err) {
errorHandler(err)
}
}
$sdk is my module where hold useApi composable based on useFetch any ideas with this error?
7 replies
NNuxt
Created by szobi on 3/23/2023 in #❓・help
useCookie set bad max-age expires
No description
3 replies
NNuxt
Created by szobi on 1/17/2023 in #❓・help
double request after use $fetch
No description
6 replies