简体   繁体   English

Node.js Bull队列未连接到Azure

[英]Nodejs Bull queue not connecting to Azure

When changing the settings inside the new bull Queue object, I get an error in the console. 更改新的Bull Queue对象内的设置时,控制台出现错误。 When running Bull Queue locally the application works perfectly fine. 在本地运行Bull Queue时,应用程序运行正常。 As soon as I change the credentials to Azure, I get the error below. 一旦将凭据更改为Azure,就会出现以下错误。 When running locally I run the redis-server but not when using the Azure credentials. 在本地运行时,我运行redis服务器,但在使用Azure凭据时不运行。

I have tried the example tutorial, on the Azure website, with nodejs and the redis npm package, and the Azure redis cache works perfectly fine. 我已经在Azure网站上使用nodejs和redis npm包尝试了示例教程,Azure redis缓存工作得很好。 Therefore, I am left to believe that I am doing something wrong in the config. 因此,我相信我在配置中做错了什么。 I have also tried adding "maxRetriesPerRequest" and "enableReadyCheck" to the redis object however, they have had no effect. 我也尝试将“ maxRetriesPerRequest”和“ enableReadyCheck”添加到redis对象,但是它们没有任何作用。 I also make sure I execute the done function within the process function. 我还要确保在流程函数中执行完了的函数。

const queue = new Queue('sendQueue', {
  defaultJobOptions: { removeOnComplete: true },
  redis: {
    port: env.AZURE_REDIS_PORT,
    host: env.AZURE_REDIS_HOST,
    password: env.AZURE_REDIS_PASSWORD
  },
});
at Queue.<anonymous> (/Users/abc/Projects/Sean/dist/tasks/sendQueue.js:47:11)
 at Queue.emit (events.js:208:15)
 at Redis.emit (events.js:203:13)
 at Redis.silentEmit (/Users/abc/Projects/Sean/node_modules/ioredis/built/redis/index.js:482:26)
 at Socket.<anonymous> (/Users/abc/Projects/Sean/node_modules/ioredis/built/redis/event_handler.js:122:14)
 at Object.onceWrapper (events.js:291:20)
 at Socket.emit (events.js:203:13)
 at emitErrorNT (internal/streams/destroy.js:91:8)
 at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
 at processTicksAndRejections (internal/process/task_queues.js:77:11)
Error: read ECONNRESET
 at TCP.onStreamRead (internal/stream_base_commons.js:183:27)

Try to add configuration for TLS when using Azure redis cache. 使用Azure Redis缓存时,尝试为TLS添加配置。 Should be the same config value as host. 应该与主机相同的配置值。 I did not manage to get a connection without it. 没有它,我没有设法建立连接。

var notificationQueue = new Queue('notifications', {
  redis: {
    port: Number(process.env.REDIS_PORT), 
    host: process.env.REDIS_HOST, 
    password: process.env.REDIS_PASS, 
    tls: {
      servername: process.env.REDIS_HOST
    }
  }});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM