Troubleshooting
Enabling Debug Logs
In the Storefront Boilerplate there are multiple ways to enable a more verbose logging both for Nuxt and Storefront Core.
To enable debug logs for Storefront Core you can set the following key in your .env
file:
# Enable debug logging in local development
NUXT_PUBLIC_STOREFRONT_LOG_LEVEL=debug
To enable Nuxt debugging logs, you can run the application with the following environment variable:
NUXT_DEBUGGING_ENABLED=true yarn dev
Both these options will give you more insight into what is happening under the hood in the application.
Redis is not available
[ioredis] Unhandled error event: Error: connect ECONNREFUSED 127.0.0.1:6379
This error means that Redis is not available. Storefront requires Redis in order to run properly.
To fix this error, either start a locally installed Redis server, or start one through the provided Docker Compose setup:
docker compose up
Composable with multiple async operations loses context
Should a composable contain multiple async
operations, it might lose its Nuxt context
for all but the first called async
operation.
This behavior can result in code not working as expected. For example:
export const useAuthenticationCallback = async () => {
const {runWithContext} = useNuxtApp()
const {setLastLoggedInUser} = await useLastLoggedInUser()
const {user, fetch: fetchUser} = await useUser({autoFetch: false})
}
The following code used runWithContext
to mitigate the loss of the Nuxt context
for all subsequent async
operation besides the first one:
export const useAuthenticationCallback = async () => {
const {runWithContext} = useNuxtApp()
const {setLastLoggedInUser} = await useLastLoggedInUser()
const {user, fetch: fetchUser} = await runWithContext(() => useUser({autoFetch: false}))
}
Details regarding this Nuxt behavior can be found here: