N
Nuxt3w ago
Jonas

How do I specify redis kv storage for production?

I added the following to the nitro configuration in nuxt.config.ts, but it looks like, the RAM is still used in production.
------------------------------
- Operating System: Windows_NT
- Node Version: v22.11.0
- Nuxt Version: 3.13.2
- CLI Version: 3.15.0
- Nitro Version: 2.9.7
- Package Manager: [email protected]
- Builder: -
- User Config: default
- Build Modules: -
------------------------------
------------------------------
- Operating System: Windows_NT
- Node Version: v22.11.0
- Nuxt Version: 3.13.2
- CLI Version: 3.15.0
- Nitro Version: 2.9.7
- Package Manager: [email protected]
- Builder: -
- User Config: default
- Build Modules: -
------------------------------
storage: {
db: {
driver: 'redis',
url: process.env.TEMPORARY_STORAGE_CONNECTION_STRING
}
},
// Development
devStorage: {
db: {
driver: 'fs',
base: './data/db'
}
}
storage: {
db: {
driver: 'redis',
url: process.env.TEMPORARY_STORAGE_CONNECTION_STRING
}
},
// Development
devStorage: {
db: {
driver: 'fs',
base: './data/db'
}
}
62 Replies
kapa.ai
kapa.ai3w ago
Hi @Jonas. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- To specify Redis KV storage for production in your Nuxt application, you're on the right track with your configuration. However, there are a few things to consider and potentially adjust: 1. Make sure you're using the correct key in your storage configuration. According to the Nitro documentation (https://nitro.unjs.io/guide/storage#configuration), you should use the mount point name as the key. In your case, you're using db, which is fine if that's the mount point you intend to use. 2. Ensure that your TEMPORARY_STORAGE_CONNECTION_STRING environment variable is correctly set in your production environment and contains a valid Redis connection URL. 3. You might want to explicitly set the Redis driver options. Here's an example of how you can modify your configuration:
export default defineNuxtConfig({
nitro: {
storage: {
db: {
driver: 'redis',
/* redis connector options */
port: process.env.REDIS_PORT,
host: process.env.REDIS_HOST,
username: '', // needs Redis >= 6
password: process.env.REDIS_PASSWORD,
db: 0, // Defaults to 0
tls: {} // tls/ssl
}
},
// Development configuration remains the same
devStorage: {
db: {
driver: 'fs',
base: './data/db'
}
}
}
})
export default defineNuxtConfig({
nitro: {
storage: {
db: {
driver: 'redis',
/* redis connector options */
port: process.env.REDIS_PORT,
host: process.env.REDIS_HOST,
username: '', // needs Redis >= 6
password: process.env.REDIS_PASSWORD,
db: 0, // Defaults to 0
tls: {} // tls/ssl
}
},
// Development configuration remains the same
devStorage: {
db: {
driver: 'fs',
base: './data/db'
}
}
}
})
This configuration is based on the examples provided in the Nuxt documentation (https://nuxt.com/docs/guide/directory-structure/server#server-storage) and the Nitro documentation (https://nitro.unjs.io/guide/storage#configuration). 4. If you're still experiencing issues, you might want to check if your Redis connection is working correctly. You can do this by creating a server API route to test the storage:
// server/api/storage/test.ts
export default defineEventHandler(async (event) => {
const storage = useStorage('db')

// Set a test key
await storage.setItem('test', 'Hello Redis!')

// Get the test key
const value = await storage.getItem('test')

return { value }
})
// server/api/storage/test.ts
export default defineEventHandler(async (event) => {
const storage = useStorage('db')

// Set a test key
await storage.setItem('test', 'Hello Redis!')

// Get the test key
const value = await storage.getItem('test')

return { value }
})
5. If you're using Vercel KV (which is based on Redis), make sure you've installed the necessary dependencies and configured it correctly as described in the Nitro Vercel KV documentation (https://nitro.unjs.io/deploy/providers/vercel#vercel-kv-storage). 6. Lastly, ensure that you're actually using the storage in your application. The configuration alone won't switch your application to use Redis; you need to use the useStorage() composable in your server code to interact with the storage. If you've followed these steps and are still experiencing issues, you might want to check your server logs for any error messages related to Redis connection or storage operations. Also, make sure that your Redis server is accessible from your production environment. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
Jonas
JonasOP3w ago
"You might want to explicitly set the Redis driver options. Here's an example of how you can modify your configuration:". is "url" not valid? @kapa.ai okay, sso this is the problem? I used const storage = useStorage('otp'); and should use db instead?
kapa.ai
kapa.ai3w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- Yes, that's correct. The issue lies in the mismatch between your storage configuration and how you're accessing it in your code. Let me explain: 1. In your Nuxt configuration, you've set up the Redis storage under the mount point db:
storage: {
db: {
driver: 'redis',
url: process.env.TEMPORARY_STORAGE_CONNECTION_STRING
}
},
storage: {
db: {
driver: 'redis',
url: process.env.TEMPORARY_STORAGE_CONNECTION_STRING
}
},
2. However, in your code, you're trying to access the storage using useStorage('otp'). To fix this, you should indeed use db instead of otp when calling useStorage(). Here's how you should modify your code:
const storage = useStorage('db');
const storage = useStorage('db');
This change will ensure that you're accessing the Redis storage you've configured in your nuxt.config.ts file. Remember, the string you pass to useStorage() should match the mount point name you've defined in your Nitro storage configuration as explained in the Nitro documentation (https://nitro.unjs.io/guide/storage#usage). If you specifically need an 'otp' namespace within your storage, you could either: 1. Change your configuration to use 'otp' as the mount point name, or 2. Use the 'db' mount point and prefix your keys with 'otp:' when storing and retrieving data. For example:
const storage = useStorage('db');
await storage.setItem('otp:someKey', 'someValue');
const value = await storage.getItem('otp:someKey');
const storage = useStorage('db');
await storage.setItem('otp:someKey', 'someValue');
const value = await storage.getItem('otp:someKey');
This approach allows you to use the 'db' mount point while still organizing your data with an 'otp' prefix. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3w ago
<@507643246902640641> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Jonas
JonasOP3w ago
great AI @ NuxtTeam! better than any chatbot i ever used @kapa.ai I get 504 [ioredis] Unhandled error event: Error: read ECONNRESET at TCP.onStreamRead (node:internal/stream_base_commons:218:20) at TCP.callbackTrampoline (node:internal/async_hooks:130:17) Vercel Runtime Timeout Error: Task timed out after 10 seconds in production. Why is that? Does ioredis not support upstash redis?
kapa.ai
kapa.ai3w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- Based on the error message you're seeing, it appears that there's an issue with the Redis connection in your production environment. Let's address this problem step by step: 1. The error "read ECONNRESET" typically indicates that the connection to the Redis server was unexpectedly closed. This could be due to network issues, firewall settings, or incorrect configuration. 2. The "Vercel Runtime Timeout Error" suggests that your function is taking too long to execute, likely because it's waiting for the Redis connection to be established or for a response from Redis. 3. Regarding your question about ioredis and Upstash Redis compatibility: ioredis does support Upstash Redis. However, there might be some specific configuration needed for Vercel and Upstash. Here are some steps you can take to troubleshoot and potentially resolve the issue: 1. First, make sure you're using the correct driver for Vercel KV (which is based on Upstash Redis). Instead of using the generic Redis driver, you should use the Vercel KV driver. Here's how you can set it up:
import { createStorage } from "unstorage";
import vercelKVDriver from "unstorage/drivers/vercel-kv";

const storage = createStorage({
driver: vercelKVDriver({
url: process.env.KV_REST_API_URL,
token: process.env.KV_REST_API_TOKEN,
}),
});

import { createStorage } from "unstorage";
import vercelKVDriver from "unstorage/drivers/vercel-kv";

const storage = createStorage({
driver: vercelKVDriver({
url: process.env.KV_REST_API_URL,
token: process.env.KV_REST_API_TOKEN,
}),
});

This configuration is based on the Unstorage Vercel KV driver documentation (https://unstorage.unjs.io/drivers/vercel). 2. Make sure you have the @vercel/kv dependency installed in your project:
{
"dependencies": {
"@vercel/kv": "latest"
}
}

{
"dependencies": {
"@vercel/kv": "latest"
}
}

3. Ensure that your KV_REST_API_URL and KV_REST_API_TOKEN environment variables are correctly set in your Vercel project settings. 4. If you're still experiencing issues, you might want to increase the function timeout in your Vercel configuration. You can do this by adding a vercel.json file to your project root with the following content:
{
"functions": {
"api/*.js": {
"maxDuration": 30
}
}
}

{
"functions": {
"api/*.js": {
"maxDuration": 30
}
}
}

This increases the function timeout to 30 seconds, which might help with the timeout error. 5. If the problem persists, you might want to implement some error handling and logging in your code to get more information about what's happening before the timeout occurs. Remember, when using Vercel KV, you don't need to use ioredis directly. The Vercel KV driver handles the connection for you. If you've been trying to use ioredis directly with Upstash on Vercel, that could be the source of your issues. If you continue to face problems after making these changes, you may need to contact Vercel support for more specific assistance with your deployment configuration. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3w ago
<@507643246902640641> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Jonas
JonasOP3w ago
@kapa.ai I only specified the url in my nitro config inside of my nuxt.config. The url does include the password, so there is no need for the token. do i have to tell the config that i use vercel somehow, because I thaught it would detect that on build.
kapa.ai
kapa.ai3w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- You're right that Vercel should typically auto-detect the Nitro preset during deployment. However, for Vercel KV storage, there are some specific configurations we need to make. Let's clarify the setup: 1. First, make sure you're using the correct driver for Vercel KV. Instead of the generic Redis driver, you should use the vercelKV driver. Here's how you can update your nuxt.config.ts:
export default defineNuxtConfig({
nitro: {
storage: {
db: {
driver: 'vercelKV'
}
}
}
})
export default defineNuxtConfig({
nitro: {
storage: {
db: {
driver: 'vercelKV'
}
}
}
})
This configuration is based on the Nitro Vercel KV documentation (https://nitro.unjs.io/deploy/providers/vercel#vercel-kv-storage). 2. You mentioned that your URL includes the password. For Vercel KV, you typically need to set two environment variables: KV_REST_API_URL and KV_REST_API_TOKEN. If your URL already includes the authentication information, you might only need to set KV_REST_API_URL. 3. Make sure you have the @vercel/kv dependency installed in your project:
{
"dependencies": {
"@vercel/kv": "latest"
}
}
{
"dependencies": {
"@vercel/kv": "latest"
}
}
4. Vercel should indeed auto-detect that you're using Nitro and apply the correct settings. However, if you want to be explicit, you can set the NITRO_PRESET environment variable to vercel in your Vercel project settings. 5. If you're still experiencing issues, you might want to try explicitly setting the Vercel preset in your nuxt.config.ts:
export default defineNuxtConfig({
nitro: {
preset: 'vercel',
storage: {
db: {
driver: 'vercelKV'
}
}
}
})
export default defineNuxtConfig({
nitro: {
preset: 'vercel',
storage: {
db: {
driver: 'vercelKV'
}
}
}
})
Remember, the Vercel KV setup is slightly different from a standard Redis setup. If you're using the Vercel KV service, make sure you're following the Vercel KV-specific instructions rather than generic Redis configurations. If you continue to face issues after making these adjustments, you might want to double-check your Vercel project settings and ensure that all necessary environment variables are correctly set. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3w ago
<@507643246902640641> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Jonas
JonasOP3w ago
@kapa.ai I don't use vercels KV, I use vercel to host. The KV is on upstash
kapa.ai
kapa.ai3w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- I apologize for the confusion in my previous responses. Thank you for clarifying that you're using Vercel for hosting and Upstash for your Redis KV storage. In this case, we need to adjust the configuration to use the Redis driver specifically for Upstash. Here's how you can set it up: 1. First, update your nuxt.config.ts file to use the Redis driver:
export default defineNuxtConfig({
nitro: {
storage: {
db: {
driver: 'redis',
url: process.env.UPSTASH_REDIS_URL
}
}
}
})
export default defineNuxtConfig({
nitro: {
storage: {
db: {
driver: 'redis',
url: process.env.UPSTASH_REDIS_URL
}
}
}
})
Make sure your UPSTASH_REDIS_URL environment variable is set correctly in your Vercel project settings. This URL should include the authentication information provided by Upstash. 2. Install the required dependencies. For Upstash Redis, you'll need to install ioredis:
{
"dependencies": {
"ioredis": "^5.0.0"
}
}
{
"dependencies": {
"ioredis": "^5.0.0"
}
}
3. Upstash Redis is compatible with ioredis, so you don't need to make any special adjustments for compatibility Upstash Redis docs (https://docs.upstash.com/redis/sdks/ioredis). 4. If you're still experiencing connection issues, you might want to increase the connection timeout. You can do this by adding more options to your Redis configuration:
export default defineNuxtConfig({
nitro: {
storage: {
db: {
driver: 'redis',
url: process.env.UPSTASH_REDIS_URL,
connectTimeout: 10000, // 10 seconds
retryStrategy: (times) => Math.min(times * 50, 2000) // retry strategy
}
}
}
})
export default defineNuxtConfig({
nitro: {
storage: {
db: {
driver: 'redis',
url: process.env.UPSTASH_REDIS_URL,
connectTimeout: 10000, // 10 seconds
retryStrategy: (times) => Math.min(times * 50, 2000) // retry strategy
}
}
}
})
5. To handle the Vercel function timeout, you can add a vercel.json file to your project root:
{
"functions": {
"api/*.js": {
"maxDuration": 30
}
}
}
{
"functions": {
"api/*.js": {
"maxDuration": 30
}
}
}
This increases the function timeout to 30 seconds, which might help with the timeout error you were experiencing. Remember to use useStorage('db') in your server-side code to access this storage mount point. If you continue to face issues after making these adjustments, you might want to implement some error handling and logging in your code to get more detailed information about what's happening before the timeout occurs. Additionally, double-check your Upstash Redis connection details and ensure that your Vercel deployment can reach the Upstash servers. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3w ago
<@507643246902640641> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Jonas
JonasOP3w ago
@kapa.ai redis://default:[email protected]:6379 does the adapter have problems with this format? do i have to add the database with /0 or something?
kapa.ai
kapa.ai3w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- The Redis URL format you've provided should work correctly with the Redis driver in Nitro. It includes all the necessary components: protocol, username, password, host, and port. You don't need to explicitly add the database number (/0) at the end unless you want to use a specific database other than the default (which is 0). However, if you're experiencing issues, there are a few things you can try: 1. Ensure that you're using the URL exactly as provided by Upstash in your environment variable. The format you've shown is correct for Upstash Redis. 2. In your nuxt.config.ts, you can try to parse the URL explicitly:
import { parse } from 'url'

export default defineNuxtConfig({
nitro: {
storage: {
db: {
driver: 'redis',
url: process.env.UPSTASH_REDIS_URL,
parse: (url) => {
const parsedUrl = parse(url)
return {
host: parsedUrl.hostname,
port: Number(parsedUrl.port),
username: parsedUrl.auth?.split(':')[0] || 'default',
password: parsedUrl.auth?.split(':')[1] || '',
tls: {}
}
}
}
}
}
})
import { parse } from 'url'

export default defineNuxtConfig({
nitro: {
storage: {
db: {
driver: 'redis',
url: process.env.UPSTASH_REDIS_URL,
parse: (url) => {
const parsedUrl = parse(url)
return {
host: parsedUrl.hostname,
port: Number(parsedUrl.port),
username: parsedUrl.auth?.split(':')[0] || 'default',
password: parsedUrl.auth?.split(':')[1] || '',
tls: {}
}
}
}
}
}
})
This approach is based on the Redis driver options in the Unstorage documentation (https://unstorage.unjs.io/drivers/redis#usage). 3. If you still encounter issues, you can try specifying the connection details separately:
export default defineNuxtConfig({
nitro: {
storage: {
db: {
driver: 'redis',
host: 'unique-wolf-22904.upstash.io',
port: 6379,
username: 'default',
password: 'xxx',
tls: {}
}
}
}
})
export default defineNuxtConfig({
nitro: {
storage: {
db: {
driver: 'redis',
host: 'unique-wolf-22904.upstash.io',
port: 6379,
username: 'default',
password: 'xxx',
tls: {}
}
}
}
})
4. Upstash Redis requires a TLS connection, so make sure to include the tls: {} option as shown above. If you're still facing connection issues after trying these approaches, it might be helpful to implement some logging or error handling in your server code to get more detailed information about what's happening during the connection attempt. Remember to replace sensitive information like passwords with environment variables in your actual configuration. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3w ago
<@507643246902640641> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Jonas
JonasOP3w ago
@kapa.ai you are telling me, that it should work, right?
nitro: {
rollupConfig: {
// @ts-ignore: "Type instantiation is excessively deep and possibly infinite."
plugins: [vue()]
},
imports: {
dirs: ['./server/utils'],
},
// Production
storage: {
db: {
driver: 'redis',
url: process.env.TEMPORARY_STORAGE_CONNECTION_STRING,
connectTimeout: 10000, // 10 seconds
}
},
// Development
devStorage: {
db: {
driver: 'fs',
base: './data/db'
}
}
},
nitro: {
rollupConfig: {
// @ts-ignore: "Type instantiation is excessively deep and possibly infinite."
plugins: [vue()]
},
imports: {
dirs: ['./server/utils'],
},
// Production
storage: {
db: {
driver: 'redis',
url: process.env.TEMPORARY_STORAGE_CONNECTION_STRING,
connectTimeout: 10000, // 10 seconds
}
},
// Development
devStorage: {
db: {
driver: 'fs',
base: './data/db'
}
}
},
const storage = useStorage('db');
const otpNameSpace = "otp";
const storage = useStorage('db');
const otpNameSpace = "otp";
kapa.ai
kapa.ai3w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- Yes, based on the configuration you've provided, it should work correctly. Let's break down why: 1. Your Nitro configuration in nuxt.config.ts is correctly set up for Redis in production:
storage: {
db: {
driver: 'redis',
url: process.env.TEMPORARY_STORAGE_CONNECTION_STRING,
connectTimeout: 10000, // 10 seconds
}
},
storage: {
db: {
driver: 'redis',
url: process.env.TEMPORARY_STORAGE_CONNECTION_STRING,
connectTimeout: 10000, // 10 seconds
}
},
This configuration uses the 'redis' driver and sets the connection URL from an environment variable, which is the correct approach as described in the Nitro documentation (https://nitro.unjs.io/guide/storage#configuration). 2. Your code for accessing the storage is also correct:
const storage = useStorage('db');
const otpNameSpace = "otp";
const storage = useStorage('db');
const otpNameSpace = "otp";
Here, you're using useStorage('db'), which matches the mount point name ('db') in your Nitro configuration as explained in the Nitro usage guide (https://nitro.unjs.io/guide/storage#usage). 3. The otpNameSpace variable you've defined can be used to prefix your keys when storing or retrieving data, which is a good practice for organizing your data within the storage. For example, you could use it like this:
await storage.setItem(`${otpNameSpace}:someKey`, 'someValue');
const value = await storage.getItem(`${otpNameSpace}:someKey`);
await storage.setItem(`${otpNameSpace}:someKey`, 'someValue');
const value = await storage.getItem(`${otpNameSpace}:someKey`);
This setup should work correctly in production, using Redis as the storage backend. In development, it will use the filesystem storage as specified in your devStorage configuration. If you're still experiencing issues, it might be related to the Redis connection itself or how the environment variable is being set and accessed in your production environment. Make sure that TEMPORARY_STORAGE_CONNECTION_STRING is correctly set in your production environment with the full Redis URL, including authentication details if required. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3w ago
<@507643246902640641> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Jonas
JonasOP3w ago
@kapa.ai It doesn't work locally too. Hm. Something is wrong with the way the app connects.
kapa.ai
kapa.ai3w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- Based on the information you've provided and our previous conversation, it seems that the issue persists both in production and locally. This suggests that there might be a problem with how the Redis connection is being established or how the storage is being accessed. Let's troubleshoot this further: 1. First, make sure that your .env file is properly set up and that Nuxt is reading it correctly. As mentioned in a Stack Overflow post about Nuxt3 .env variables (https://stackoverflow.com/questions/77438972), Nuxt CLI has built-in dotenv support. Your .env file should be in the root of your project and follow the format:
TEMPORARY_STORAGE_CONNECTION_STRING=redis://default:[email protected]:6379

TEMPORARY_STORAGE_CONNECTION_STRING=redis://default:[email protected]:6379

2. To verify that the environment variable is being read correctly, you can add a console.log statement in your nuxt.config.ts:
console.log('Redis URL:', process.env.TEMPORARY_STORAGE_CONNECTION_STRING);

console.log('Redis URL:', process.env.TEMPORARY_STORAGE_CONNECTION_STRING);

3. If you're using Redis locally for development, ensure that you have a Redis server running and accessible. 4. To further debug the connection, you can try adding more detailed error handling in your code where you use the storage. For example:
const storage = useStorage('db');
try {
await storage.setItem('test', 'value');
console.log('Storage connection successful');
} catch (error) {
console.error('Storage connection failed:', error);
}

const storage = useStorage('db');
try {
await storage.setItem('test', 'value');
console.log('Storage connection successful');
} catch (error) {
console.error('Storage connection failed:', error);
}

5. If you're still having issues, you might want to try using the Redis driver directly to test the connection. You can do this in a server middleware or plugin:
import { createClient } from 'redis';
export default defineNitroPlugin(async () => {
const client = createClient({
url: process.env.TEMPORARY_STORAGE_CONNECTION_STRING
});
client.on('error', (err) => console.log('Redis Client Error', err));
await client.connect();
try {
await client.set('test', 'value');
console.log('Redis connection successful');
} catch (error) {
console.error('Redis connection failed:', error);
} finally {
await client.disconnect();
}
});

import { createClient } from 'redis';
export default defineNitroPlugin(async () => {
const client = createClient({
url: process.env.TEMPORARY_STORAGE_CONNECTION_STRING
});
client.on('error', (err) => console.log('Redis Client Error', err));
await client.connect();
try {
await client.set('test', 'value');
console.log('Redis connection successful');
} catch (error) {
console.error('Redis connection failed:', error);
} finally {
await client.disconnect();
}
});

6. Make sure you have the necessary dependencies installed. For Redis, you typically need:
{
"dependencies": {
"redis": "^4.0.0"
}
}

{
"dependencies": {
"redis": "^4.0.0"
}
}

7. If you're using Upstash Redis, ensure that your firewall settings allow connections to the Redis server. Upstash provides a list of IP addresses that you might need to whitelist. If after trying these steps you're still encountering issues, it would be helpful to see any error messages or logs that are being generated. This could provide more specific information about what's going wrong with the connection. Remember, when troubleshooting, it's often helpful to start with the simplest possible configuration and gradually add complexity until you identify where the problem occurs. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3w ago
<@507643246902640641> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Jonas
JonasOP3w ago
@kapa.ai Am I using it wrong? I use the composable inside of a server route. I get this error: ERROR [ioredis] Unhandled error event: Error: read ECONNRESET at TCP.onStreamRead (node:internal/stream_base_commons:216:20) at TCP.callbackTrampoline (node:internal/async_hooks:130:17) ERROR [ioredis] Unhandled error event: MaxRetriesPerRequestError: Reached the max retries per request limit (which is 20). Refer to "maxRetriesPerRequest" option for details. at Socket.<anonymous> (D:\xxx\node_modules\ioredis\built\redis\event_handler.js:182:37) at Object.onceWrapper (node:events:633:26) at Socket.emit (node:events:518:28) at TCP.<anonymous> (node:net:343:12) at TCP.callbackTrampoline (node:internal/async_hooks:130:17) ERROR [nuxt] [request error] [unhandled] [500] Reached the max retries per request limit (which is 20). Refer to "maxRetriesPerRequest" option for details. at Socket.<anonymous> (D:\xxx\node_modules\ioredis\built\redis\event_handler.js:182:37) at Object.onceWrapper (node:events:633:26) at Socket.emit (node:events:518:28) at TCP.<anonymous> (node:net:343:12) at TCP.callbackTrampoline (node:internal/async_hooks:130:17)
kapa.ai
kapa.ai3w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- Based on the error messages you're seeing, it appears that there's an issue with the Redis connection when you're using the storage composable inside a server route. Let's address this problem step by step: 1. The "read ECONNRESET" error typically indicates that the connection to the Redis server was unexpectedly closed. This could be due to network issues, firewall settings, or incorrect configuration. 2. The "MaxRetriesPerRequestError" suggests that the Redis client is trying to reconnect but failing repeatedly. Here are some steps you can take to troubleshoot and potentially resolve the issue: 1. First, make sure your Redis connection string is correct and that the Redis server is accessible from your development environment. You can test this by trying to connect to Redis using a Redis CLI or another tool. 2. In your nuxt.config.ts, try adding more configuration options to the Redis driver to handle retries and timeouts:
export default defineNuxtConfig({
nitro: {
storage: {
db: {
driver: 'redis',
url: process.env.TEMPORARY_STORAGE_CONNECTION_STRING,
connectTimeout: 5000, // 5 seconds
maxRetriesPerRequest: 3,
retryStrategy: (times) => {
if (times > 3) {
return null; // stop retrying after 3 attempts
}
return Math.min(times * 200, 3000); // wait 200ms, 400ms, then 600ms
}
}
}
}
})
export default defineNuxtConfig({
nitro: {
storage: {
db: {
driver: 'redis',
url: process.env.TEMPORARY_STORAGE_CONNECTION_STRING,
connectTimeout: 5000, // 5 seconds
maxRetriesPerRequest: 3,
retryStrategy: (times) => {
if (times > 3) {
return null; // stop retrying after 3 attempts
}
return Math.min(times * 200, 3000); // wait 200ms, 400ms, then 600ms
}
}
}
}
})
This configuration is based on the ioredis options (https://github.com/luin/ioredis/blob/master/API.md#new-redisport-host-options) and the Unstorage Redis driver documentation (https://unstorage.unjs.io/drivers/redis#usage). 3. If you're using the storage composable in a server route, make sure you're using it correctly. Here's an example of how you might use it:
export default defineEventHandler(async (event) => {
const storage = useStorage('db');
try {
await storage.setItem('test', 'value');
const value = await storage.getItem('test');
return { success: true, value };
} catch (error) {
console.error('Storage operation failed:', error);
return { success: false, error: error.message };
}
});
export default defineEventHandler(async (event) => {
const storage = useStorage('db');
try {
await storage.setItem('test', 'value');
const value = await storage.getItem('test');
return { success: true, value };
} catch (error) {
console.error('Storage operation failed:', error);
return { success: false, error: error.message };
}
});
4. If you're still experiencing issues, you might want to implement some error handling and logging in your code to get more information about what's happening before the error occurs. 5. Make sure you have the latest version of ioredis installed in your project:
{
"dependencies": {
"ioredis": "^5.0.0"
}
}
{
"dependencies": {
"ioredis": "^5.0.0"
}
}
6. If you're using Upstash Redis, ensure that your firewall settings allow connections to the Redis server. Upstash provides a list of IP addresses that you might need to whitelist. If you continue to face problems after making these changes, you may need to investigate your network configuration or contact your Redis provider (if you're using a hosted solution) for more specific assistance. Remember, when using Redis in a development environment, make sure you have a Redis server running locally or that you're connecting to a remote Redis instance that's accessible from your development machine. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3w ago
<@507643246902640641> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Jonas
JonasOP3w ago
@kapa.ai Oh, useStorage can only be used inside of the handler?
kapa.ai
kapa.ai3w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- Yes, that's correct. The useStorage composable can only be used inside event handlers or other server-side contexts in Nuxt. This is because useStorage is part of Nuxt's server-side utilities and requires the Nuxt runtime context to function properly. According to the Nuxt documentation on auto-imports (https://nuxt.com/docs/guide/concepts/auto-imports#vue-and-nuxt-composables), many composables, including those provided by Nuxt, rely on being called in the right context. They need to be used synchronously within a Nuxt plugin, Nuxt route middleware, or a Vue setup function. For server-side operations, like in API routes or server middleware, you should use useStorage within the defineEventHandler function. Here's an example of the correct usage:
export default defineEventHandler(async (event) => {
const storage = useStorage('db');
// Use storage here
const value = await storage.getItem('someKey');
return { value };
});
export default defineEventHandler(async (event) => {
const storage = useStorage('db');
// Use storage here
const value = await storage.getItem('someKey');
return { value };
});
If you were trying to use useStorage outside of these contexts, such as at the top level of a server file or in a utility function, that would explain the errors you were encountering. Always ensure you're using useStorage within the appropriate server-side handlers or middleware functions. Remember, this restriction is in place to maintain the proper runtime context and to avoid issues with cross-request state pollution, especially important in server-side rendering scenarios. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3w ago
<@507643246902640641> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Jonas
JonasOP3w ago
@kapa.ai Why did it work, when I didn't use the redis, but the fs adapter?
kapa.ai
kapa.ai3w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- The reason why it worked when you used the filesystem (fs) adapter but not with the Redis adapter is related to how these different storage drivers operate and their dependencies. 1. Filesystem (fs) adapter: The filesystem adapter is built into Nitro and doesn't require any external connections or dependencies. It simply reads from and writes to the local filesystem, which is always available in a Node.js environment. This is why it worked without any issues as mentioned in the Nitro documentation (https://nitro.unjs.io/guide/storage#development-only-mount-points). 2. Redis adapter: The Redis adapter, on the other hand, requires an external connection to a Redis server. This introduces several potential points of failure: - Network connectivity: Redis needs to establish a network connection, which can fail due to various reasons (firewall, misconfiguration, etc.). - Authentication: If the Redis server requires authentication, any issues with credentials can cause connection failures. - Dependencies: The Redis adapter relies on the ioredis library, which needs to be installed and properly configured. Additionally, the context in which you use useStorage is crucial. As we discussed earlier, useStorage must be used within the correct server-side context, such as inside an event handler. This requirement applies to both fs and Redis adapters, but it's more likely to cause visible errors with Redis due to its asynchronous nature and external dependencies. When using the fs adapter, operations are typically synchronous and don't involve external connections, so even if used incorrectly, it might not immediately result in visible errors. To ensure proper usage with Redis: 1. Make sure useStorage is used within defineEventHandler or similar server-side contexts. 2. Verify that your Redis connection string is correct and the Redis server is accessible. 3. Ensure all necessary dependencies (like ioredis) are installed. 4. Handle potential connection errors and implement proper error logging. By addressing these points, you should be able to get the Redis adapter working as smoothly as the fs adapter did. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3w ago
<@507643246902640641> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Jonas
JonasOP3w ago
xxx @kapa.ai same issue. do i have to setup anything else? :/
kapa.ai
kapa.ai3w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- I apologize that you're still experiencing the same issue. Let's go through a few more troubleshooting steps to ensure everything is set up correctly: 1. First, make sure you have the necessary dependencies installed. For Redis, you typically need:
{
"dependencies": {
"ioredis": "^5.0.0"
}
}
{
"dependencies": {
"ioredis": "^5.0.0"
}
}
2. In your nuxt.config.ts, try adding more detailed configuration for the Redis driver:
export default defineNuxtConfig({
nitro: {
storage: {
db: {
driver: 'redis',
url: process.env.TEMPORARY_STORAGE_CONNECTION_STRING,
connectTimeout: 5000, // 5 seconds
maxRetriesPerRequest: 3,
retryStrategy: (times) => {
if (times > 3) {
return null; // stop retrying after 3 attempts
}
return Math.min(times * 200, 3000); // wait 200ms, 400ms, then 600ms
},
tls: {} // Enable TLS for secure connections
}
}
}
})
export default defineNuxtConfig({
nitro: {
storage: {
db: {
driver: 'redis',
url: process.env.TEMPORARY_STORAGE_CONNECTION_STRING,
connectTimeout: 5000, // 5 seconds
maxRetriesPerRequest: 3,
retryStrategy: (times) => {
if (times > 3) {
return null; // stop retrying after 3 attempts
}
return Math.min(times * 200, 3000); // wait 200ms, 400ms, then 600ms
},
tls: {} // Enable TLS for secure connections
}
}
}
})
This configuration is based on the Unstorage Redis driver documentation (https://unstorage.unjs.io/drivers/redis#usage). 3. Ensure that your TEMPORARY_STORAGE_CONNECTION_STRING environment variable is correctly set in your .env file:
TEMPORARY_STORAGE_CONNECTION_STRING=redis://default:[email protected]:6379
TEMPORARY_STORAGE_CONNECTION_STRING=redis://default:[email protected]:6379
4. In your server route, make sure you're using useStorage correctly within an event handler:
export default defineEventHandler(async (event) => {
const storage = useStorage('db');
try {
await storage.setItem('test', 'value');
const value = await storage.getItem('test');
console.log('Storage operation successful:', value);
return { success: true, value };
} catch (error) {
console.error('Storage operation failed:', error);
return { success: false, error: error.message };
}
});
export default defineEventHandler(async (event) => {
const storage = useStorage('db');
try {
await storage.setItem('test', 'value');
const value = await storage.getItem('test');
console.log('Storage operation successful:', value);
return { success: true, value };
} catch (error) {
console.error('Storage operation failed:', error);
return { success: false, error: error.message };
}
});
5. If you're using Upstash Redis, ensure that your firewall settings allow connections to the Redis server. Upstash provides a list of IP addresses that you might need to whitelist. 6. You might also want to try using the Redis client directly in a server plugin to test the connection:
import { createClient } from 'redis';

export default defineNitroPlugin(async () => {
const client = createClient({
url: process.env.TEMPORARY_STORAGE_CONNECTION_STRING
});
client.on('error', (err) => console.log('Redis Client Error', err));
try {
await client.connect();
await client.set('test', 'value');
console.log('Redis connection successful');
} catch (error) {
console.error('Redis connection failed:', error);
} finally {
await client.disconnect();
}
});
import { createClient } from 'redis';

export default defineNitroPlugin(async () => {
const client = createClient({
url: process.env.TEMPORARY_STORAGE_CONNECTION_STRING
});
client.on('error', (err) => console.log('Redis Client Error', err));
try {
await client.connect();
await client.set('test', 'value');
console.log('Redis connection successful');
} catch (error) {
console.error('Redis connection failed:', error);
} finally {
await client.disconnect();
}
});
If after trying these steps you're still encountering issues, it would be helpful to see any new error messages or logs that are being generated. This could provide more specific information about what's going wrong with the connection. Remember, when troubleshooting Redis connections, it's important to ensure that your development environment can reach the Redis server, and that all network and firewall settings are correctly configured. Nitro documentation (https://nitro.unjs.io/guide/storage#configuration) and Unstorage Redis driver documentation (https://unstorage.unjs.io/drivers/redis#usage) are good resources for further configuration options and troubleshooting tips. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3w ago
<@507643246902640641> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Jonas
JonasOP3w ago
:/ xxx @kapa.ai do i need this?
import redisDriver from 'unstorage/drivers/redis'

export default defineNitroPlugin(() => {
const storage = useStorage()

const driver = redisDriver({
base: 'db',
host: useRuntimeConfig().temporaryStorageConnectionString
})

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

export default defineNitroPlugin(() => {
const storage = useStorage()

const driver = redisDriver({
base: 'db',
host: useRuntimeConfig().temporaryStorageConnectionString
})

storage.mount('db', driver)
})
kapa.ai
kapa.ai3w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- Based on the configuration you've shown in previous messages and the current state of your setup, you don't necessarily need this additional plugin code. Let me explain why: 1. You've already configured the Redis storage in your nuxt.config.ts file using the nitro.storage option. This is the recommended way to set up storage drivers in Nuxt 3 with Nitro as described in the Nitro documentation (https://nitro.unjs.io/guide/storage#configuration). 2. The code you're showing is typically used when you need to dynamically configure storage at runtime or when you're using a custom driver that's not directly supported by Nitro's configuration options. 3. In your case, since you're using a standard Redis setup, the configuration in nuxt.config.ts should be sufficient:
export default defineNuxtConfig({
nitro: {
storage: {
db: {
driver: 'redis',
url: process.env.TEMPORARY_STORAGE_CONNECTION_STRING,
// other options...
}
}
}
})
export default defineNuxtConfig({
nitro: {
storage: {
db: {
driver: 'redis',
url: process.env.TEMPORARY_STORAGE_CONNECTION_STRING,
// other options...
}
}
}
})
This configuration automatically sets up the Redis driver for the 'db' mount point, which you can then use with useStorage('db') in your server routes. However, if you're still experiencing connection issues, and you want to try a more explicit setup, you could use a modified version of the plugin you showed:
import redisDriver from 'unstorage/drivers/redis'

export default defineNitroPlugin(() => {
const storage = useStorage()
const config = useRuntimeConfig()

const driver = redisDriver({
url: config.temporaryStorageConnectionString,
// Add other options as needed
connectTimeout: 5000,
maxRetriesPerRequest: 3,
tls: {}
})

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

export default defineNitroPlugin(() => {
const storage = useStorage()
const config = useRuntimeConfig()

const driver = redisDriver({
url: config.temporaryStorageConnectionString,
// Add other options as needed
connectTimeout: 5000,
maxRetriesPerRequest: 3,
tls: {}
})

storage.mount('db', driver)
})
This approach might give you more control over the driver configuration and could potentially help in troubleshooting connection issues. Remember to ensure that temporaryStorageConnectionString is properly defined in your runtime config if you choose to use this method. In most cases, though, the configuration in nuxt.config.ts should be sufficient, and you shouldn't need this additional plugin unless you have specific requirements not covered by the standard configuration options. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3w ago
<@507643246902640641> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Jonas
JonasOP3w ago
@kapa.ai doesn't work anyway. I get defineNitroPlugin is not defined...
kapa.ai
kapa.ai3w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- I apologize for the confusion. The error "defineNitroPlugin is not defined" suggests that the defineNitroPlugin function is not being imported correctly. Let's address this issue: 1. First, make sure you're importing defineNitroPlugin at the top of your file:
import { defineNitroPlugin } from 'nitropack'
import { defineNitroPlugin } from 'nitropack'
This import is necessary because defineNitroPlugin is not automatically available as a global in Nuxt 3 as mentioned in the Nitro documentation (https://nitro.unjs.io/guide/plugins). 2. If you're still getting the error after adding the import, it's possible that your development environment isn't recognizing the Nitro types. In this case, you can try using the following import instead:
import { defineNitroPlugin } from '#imports'
import { defineNitroPlugin } from '#imports'
This import syntax is specific to Nuxt 3 and should work within the Nuxt project context. 3. If you're still encountering issues, make sure that your tsconfig.json or jsconfig.json is set up correctly to recognize Nuxt's auto-imports. You can add the following to your configuration:
{
"extends": "./.nuxt/tsconfig.json"
}
{
"extends": "./.nuxt/tsconfig.json"
}
4. If none of the above solutions work, you might want to consider using a server plugin instead of a Nitro plugin. Server plugins in Nuxt 3 are placed in the server/plugins directory and are automatically loaded. Here's how you could rewrite your plugin as a server plugin:
// server/plugins/redis.ts
import redisDriver from 'unstorage/drivers/redis'

export default defineNitroPlugin(() => {
const storage = useStorage()
const config = useRuntimeConfig()

const driver = redisDriver({
url: config.temporaryStorageConnectionString,
// Add other options as needed
connectTimeout: 5000,
maxRetriesPerRequest: 3,
tls: {}
})

storage.mount('db', driver)
})
// server/plugins/redis.ts
import redisDriver from 'unstorage/drivers/redis'

export default defineNitroPlugin(() => {
const storage = useStorage()
const config = useRuntimeConfig()

const driver = redisDriver({
url: config.temporaryStorageConnectionString,
// Add other options as needed
connectTimeout: 5000,
maxRetriesPerRequest: 3,
tls: {}
})

storage.mount('db', driver)
})
Remember, server plugins in Nuxt 3 don't need to export anything by default, and defineNitroPlugin should be available in this context. If you're still experiencing issues after trying these solutions, it might be helpful to review your project structure and ensure that all necessary dependencies are installed and up to date. You might also want to consider creating a minimal reproduction of the issue to isolate the problem. Nuxt 3 documentation on server plugins (https://nuxt.com/docs/guide/directory-structure/server#plugins) and Nitro documentation on plugins (https://nitro.unjs.io/guide/plugins) provide more information on how to properly set up and use plugins in your Nuxt 3 application. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3w ago
<@507643246902640641> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Jonas
JonasOP3w ago
@kapa.ai Module '"nitropack"' has no exported member 'defineNitroPlugin'.
kapa.ai
kapa.ai3w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- I apologize for the confusion. It seems that the defineNitroPlugin function is not directly exported from 'nitropack' as I previously suggested. Let's correct this and provide the proper way to define a Nitro plugin in Nuxt 3: 1. In Nuxt 3, you don't need to explicitly import defineNitroPlugin. Instead, it should be available as a global in your server files. Try using it directly without an import:
export default defineNitroPlugin((nitroApp) => {
// Your plugin code here
})
export default defineNitroPlugin((nitroApp) => {
// Your plugin code here
})
2. If you're still getting an error, you can try using the #imports syntax, which is specific to Nuxt 3:
import { defineNitroPlugin } from '#imports'

export default defineNitroPlugin((nitroApp) => {
// Your plugin code here
})
import { defineNitroPlugin } from '#imports'

export default defineNitroPlugin((nitroApp) => {
// Your plugin code here
})
3. Make sure your plugin file is located in the correct directory. In Nuxt 3, server plugins should be placed in the server/plugins directory as mentioned in the Nuxt documentation (https://nuxt.com/docs/guide/directory-structure/server#plugins). 4. If you're still encountering issues, it might be related to your TypeScript configuration. Ensure that your tsconfig.json extends the Nuxt-generated TypeScript configuration:
{
"extends": "./.nuxt/tsconfig.json"
}
{
"extends": "./.nuxt/tsconfig.json"
}
5. If none of the above solutions work, you might want to try using defineNitroPlugin from the h3 package, which is used by Nitro:
import { defineNitroPlugin } from 'h3'

export default defineNitroPlugin((nitroApp) => {
// Your plugin code here
})
import { defineNitroPlugin } from 'h3'

export default defineNitroPlugin((nitroApp) => {
// Your plugin code here
})
Remember, Nitro plugins in Nuxt 3 are automatically loaded from the server/plugins directory, so you don't need to register them manually. If you continue to face issues, it might be helpful to check your Nuxt and Nitro versions, and ensure they are up to date. You can do this by running npm list nuxt nitropack in your project directory.
manniL
manniL3w ago
should be auto imported
kapa.ai
kapa.ai3w ago
Nuxt 3 documentation on server plugins (https://nuxt.com/docs/guide/directory-structure/server#plugins) provides more information on how to properly set up and use plugins in your Nuxt 3 application. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3w ago
<@507643246902640641> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Jonas
JonasOP3w ago
I know. But it isn't. defineNuxtPlugin works fine
manniL
manniL3w ago
where do you put your plugin file?
Jonas
JonasOP3w ago
my bad... Yeah, that was stupid... Put it in the nuxt plugin folder, instead of the nitro one. But could you help me with the unstorage composable. I don't get how to properly configure it.
manniL
manniL3w ago
glad that's solved 😋
manniL
manniL3w ago
KV Storage - Nitro
Nitro provides a built-in storage layer that can abstract filesystem or database or any other data source.
manniL
manniL3w ago
^for the configuration
Jonas
JonasOP3w ago
and I have to use that? What about?
storage: {
db: {
driver: 'redis',
url: process.env.TEMPORARY_STORAGE_CONNECTION_STRING
}
},
// Development
devStorage: {
db: {
driver: 'redis',
url: process.env.TEMPORARY_STORAGE_CONNECTION_STRING
/* driver: 'fs',
base: './data/db' */
}
}
storage: {
db: {
driver: 'redis',
url: process.env.TEMPORARY_STORAGE_CONNECTION_STRING
}
},
// Development
devStorage: {
db: {
driver: 'redis',
url: process.env.TEMPORARY_STORAGE_CONNECTION_STRING
/* driver: 'fs',
base: './data/db' */
}
}
Is this not sufficient? I only use it in the server routes
manniL
manniL3w ago
if you want to change the URL at runtime no.
Jonas
JonasOP3w ago
I don't think I want to. I just need that one base, which I called "db". It just times out.
Jonas
JonasOP3w ago
manniL
manniL3w ago
I'd try it with the plugin as per docs (+ check that the server is reachable)
Jonas
JonasOP3w ago
This is what I get now: Okay, I will try to create a new database...
ERROR [ioredis] Unhandled error event: Error: getaddrinfo EAI_FAIL redis://default:[email protected]:6379
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26)
at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:130:17)
ERROR [ioredis] Unhandled error event: Error: getaddrinfo EAI_FAIL redis://default:[email protected]:6379
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26)
at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:130:17)
Seems to be an issue with ioredis and upstash. I used upstash with "redis" and a connection url in the past which worked fine. I might have to use it with the parameters host, port etc. instead. Okay: This is the issue: Try setting family: 6; for some reason ioredis defaults to family: 4 and AWS may be using (only) IPv6. Note I had the same issue on fly.io.
Jonas
JonasOP3w ago
GitHub
Unhandled error event: Error: getaddrinfo ENOTFOUND - AWS ElasticC...
Hey guys, did anyone have some issue like that to connect in the AWS ElasticCache in the ECS Container? [ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND cursobeta-dev-elasticache-redis...
Jonas
JonasOP3w ago
Can be set as query parameter like so: ?family=6 nevermind. the only thing that worked is the vercelKVDriver driver somehow. it looked like it worked, but it just used the fallback...
manniL
manniL3w ago
be aware that ioredis doesn't work on workers (https://nitro.unjs.io/deploy/workers#incompatible-libraries)
Edge Workers - Nitro
Nitro provides out of the box support for deploying to Edge Workers.
Jonas
JonasOP3w ago
That was the problem! Thank you! Great videos btw. :).
manniL
manniL3w ago
Thanks 🙏 And glad you solved it!
Want results from more Discord servers?
Add your server