ioredis & google cloud functions configuration












0















I currently have a Google Cloud Function (written in typescript) which I need to connect to a redis cache (I am using redis as a queue/metrics collection hybrid) in order to enqueue jobs for my workers which are running elsewhere.



Everything is functioning, when I lpush into my redis cache, everything works as I expected, the pipeline execs fine. But I'm getting thousdands of these errors:
[ioredis] Unhandled error event: Error: read ECONNRESET



They don't seem to impact the cloud function execution but they are incessant and affecting the logs of all my cloud functions since they are all being imported in my index.ts. I'm desperate for anyone with insight into this, spent days trying everything I can find on the internet to fix.



For reference, I'm using a Azure Redis Cache (premium) and when I connect via redis-cli, I see what I presume to be the cloud functions initiating connections and authenticating succesfully, lpushing into the queue as expected, etc.



I have /utils/index.ts which is the file where I am using the redis (nowhere else). I am importing it like so:



import { _createRedis } from './redis';

const redis = _createRedis();


Here is a sample function where I am using the redis:



   export async function runExtractor(): Promise<any> {
const data = await getActiveProfile();
const pipeline = redis.pipeline();
pipeline.lpush(`profile-extractor:jobs`, JSON.stringify((sanitizeSpec(data))));
const result = await pipeline.exec();
console.log('executed pipeline', { resultCount: result.length });
}


redis.ts contents:



    import * as Redis from 'ioredis';

// export const redis = new Redis(6380, 'MYCACHE.redis.cache.windows.net', { tls: true as any, password: 'PASSWORD' });

export const _createRedis = () => {
return new Redis(6380, 'azuresucks.redis.cache.windows.net', { tls: true as any, password: 'PASSWORD' });;
}


As you can see, I've been fiddling with the tls settings, exporting it as a function, but nothing is working. From what I could find, it could be related to the way ioredis works with Azure Redis Cache and the SSL settings. This was the closest I could find to my issue, but the answer there didn't work for me.
ioredis issue



Notably, I am not experiencing this issue outside of the google cloud functions environment. I am running the workers on google compute engine, they are connecting to the redis just fine, and popping items off the queue and performing their work. To reiterate, everything WORKS but this is obviously not desirable:
stackdriver error reporting










share|improve this question



























    0















    I currently have a Google Cloud Function (written in typescript) which I need to connect to a redis cache (I am using redis as a queue/metrics collection hybrid) in order to enqueue jobs for my workers which are running elsewhere.



    Everything is functioning, when I lpush into my redis cache, everything works as I expected, the pipeline execs fine. But I'm getting thousdands of these errors:
    [ioredis] Unhandled error event: Error: read ECONNRESET



    They don't seem to impact the cloud function execution but they are incessant and affecting the logs of all my cloud functions since they are all being imported in my index.ts. I'm desperate for anyone with insight into this, spent days trying everything I can find on the internet to fix.



    For reference, I'm using a Azure Redis Cache (premium) and when I connect via redis-cli, I see what I presume to be the cloud functions initiating connections and authenticating succesfully, lpushing into the queue as expected, etc.



    I have /utils/index.ts which is the file where I am using the redis (nowhere else). I am importing it like so:



    import { _createRedis } from './redis';

    const redis = _createRedis();


    Here is a sample function where I am using the redis:



       export async function runExtractor(): Promise<any> {
    const data = await getActiveProfile();
    const pipeline = redis.pipeline();
    pipeline.lpush(`profile-extractor:jobs`, JSON.stringify((sanitizeSpec(data))));
    const result = await pipeline.exec();
    console.log('executed pipeline', { resultCount: result.length });
    }


    redis.ts contents:



        import * as Redis from 'ioredis';

    // export const redis = new Redis(6380, 'MYCACHE.redis.cache.windows.net', { tls: true as any, password: 'PASSWORD' });

    export const _createRedis = () => {
    return new Redis(6380, 'azuresucks.redis.cache.windows.net', { tls: true as any, password: 'PASSWORD' });;
    }


    As you can see, I've been fiddling with the tls settings, exporting it as a function, but nothing is working. From what I could find, it could be related to the way ioredis works with Azure Redis Cache and the SSL settings. This was the closest I could find to my issue, but the answer there didn't work for me.
    ioredis issue



    Notably, I am not experiencing this issue outside of the google cloud functions environment. I am running the workers on google compute engine, they are connecting to the redis just fine, and popping items off the queue and performing their work. To reiterate, everything WORKS but this is obviously not desirable:
    stackdriver error reporting










    share|improve this question

























      0












      0








      0








      I currently have a Google Cloud Function (written in typescript) which I need to connect to a redis cache (I am using redis as a queue/metrics collection hybrid) in order to enqueue jobs for my workers which are running elsewhere.



      Everything is functioning, when I lpush into my redis cache, everything works as I expected, the pipeline execs fine. But I'm getting thousdands of these errors:
      [ioredis] Unhandled error event: Error: read ECONNRESET



      They don't seem to impact the cloud function execution but they are incessant and affecting the logs of all my cloud functions since they are all being imported in my index.ts. I'm desperate for anyone with insight into this, spent days trying everything I can find on the internet to fix.



      For reference, I'm using a Azure Redis Cache (premium) and when I connect via redis-cli, I see what I presume to be the cloud functions initiating connections and authenticating succesfully, lpushing into the queue as expected, etc.



      I have /utils/index.ts which is the file where I am using the redis (nowhere else). I am importing it like so:



      import { _createRedis } from './redis';

      const redis = _createRedis();


      Here is a sample function where I am using the redis:



         export async function runExtractor(): Promise<any> {
      const data = await getActiveProfile();
      const pipeline = redis.pipeline();
      pipeline.lpush(`profile-extractor:jobs`, JSON.stringify((sanitizeSpec(data))));
      const result = await pipeline.exec();
      console.log('executed pipeline', { resultCount: result.length });
      }


      redis.ts contents:



          import * as Redis from 'ioredis';

      // export const redis = new Redis(6380, 'MYCACHE.redis.cache.windows.net', { tls: true as any, password: 'PASSWORD' });

      export const _createRedis = () => {
      return new Redis(6380, 'azuresucks.redis.cache.windows.net', { tls: true as any, password: 'PASSWORD' });;
      }


      As you can see, I've been fiddling with the tls settings, exporting it as a function, but nothing is working. From what I could find, it could be related to the way ioredis works with Azure Redis Cache and the SSL settings. This was the closest I could find to my issue, but the answer there didn't work for me.
      ioredis issue



      Notably, I am not experiencing this issue outside of the google cloud functions environment. I am running the workers on google compute engine, they are connecting to the redis just fine, and popping items off the queue and performing their work. To reiterate, everything WORKS but this is obviously not desirable:
      stackdriver error reporting










      share|improve this question














      I currently have a Google Cloud Function (written in typescript) which I need to connect to a redis cache (I am using redis as a queue/metrics collection hybrid) in order to enqueue jobs for my workers which are running elsewhere.



      Everything is functioning, when I lpush into my redis cache, everything works as I expected, the pipeline execs fine. But I'm getting thousdands of these errors:
      [ioredis] Unhandled error event: Error: read ECONNRESET



      They don't seem to impact the cloud function execution but they are incessant and affecting the logs of all my cloud functions since they are all being imported in my index.ts. I'm desperate for anyone with insight into this, spent days trying everything I can find on the internet to fix.



      For reference, I'm using a Azure Redis Cache (premium) and when I connect via redis-cli, I see what I presume to be the cloud functions initiating connections and authenticating succesfully, lpushing into the queue as expected, etc.



      I have /utils/index.ts which is the file where I am using the redis (nowhere else). I am importing it like so:



      import { _createRedis } from './redis';

      const redis = _createRedis();


      Here is a sample function where I am using the redis:



         export async function runExtractor(): Promise<any> {
      const data = await getActiveProfile();
      const pipeline = redis.pipeline();
      pipeline.lpush(`profile-extractor:jobs`, JSON.stringify((sanitizeSpec(data))));
      const result = await pipeline.exec();
      console.log('executed pipeline', { resultCount: result.length });
      }


      redis.ts contents:



          import * as Redis from 'ioredis';

      // export const redis = new Redis(6380, 'MYCACHE.redis.cache.windows.net', { tls: true as any, password: 'PASSWORD' });

      export const _createRedis = () => {
      return new Redis(6380, 'azuresucks.redis.cache.windows.net', { tls: true as any, password: 'PASSWORD' });;
      }


      As you can see, I've been fiddling with the tls settings, exporting it as a function, but nothing is working. From what I could find, it could be related to the way ioredis works with Azure Redis Cache and the SSL settings. This was the closest I could find to my issue, but the answer there didn't work for me.
      ioredis issue



      Notably, I am not experiencing this issue outside of the google cloud functions environment. I am running the workers on google compute engine, they are connecting to the redis just fine, and popping items off the queue and performing their work. To reiterate, everything WORKS but this is obviously not desirable:
      stackdriver error reporting







      azure redis google-cloud-functions azure-redis-cache ioredis






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 25 '18 at 15:07









      NicoNico

      13




      13
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53468824%2fioredis-google-cloud-functions-configuration%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53468824%2fioredis-google-cloud-functions-configuration%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Costa Masnaga

          Fotorealismo

          Sidney Franklin