How to connect ioredis to google cloud function?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I am currently running some Google Cloud functions (in typescript) that require a connection to a Redis instance in order to LPUSH
into the queue (on other instances, I am using Redis as a queue worker).
Everything is fine, except I am getting a huge number of ECONNECTRESET
and ECONNECTIMEOUT
related errors despite everything working properly.
The following code can execute successfully on the cloud function but still, I am seeing constant errors thrown related to the connection to the Redis.
I think it is somehow related to how I am importing my client- ioredis
. I have utils/index.ts
, utils/redis.js
and inside the redis.js
I have:
const Redis = require('ioredis');
module.exports = new Redis(6380, 'MYCACHE.redis.cache.windows.net', { tls: true, password: 'PASS' });
Then I am importing this in my utils/index.ts
like so: code missing
And exporting some aysnc function like: code missing
When executing in the GCF
environment, I get the # of expected results in results.length
and I see (by monitoring the Redis internally) this list was pushed as expected to the queue.
Nevertheless, these errors continue to appear incessantly.
ioredis] Unhandled error event: Error: read ECONNRESET at _errnoException (util.js:1022:11) at TLSWrap.onread (net.js:628:25)
redis google-cloud-platform google-cloud-firestore google-cloud-functions ioredis
add a comment |
I am currently running some Google Cloud functions (in typescript) that require a connection to a Redis instance in order to LPUSH
into the queue (on other instances, I am using Redis as a queue worker).
Everything is fine, except I am getting a huge number of ECONNECTRESET
and ECONNECTIMEOUT
related errors despite everything working properly.
The following code can execute successfully on the cloud function but still, I am seeing constant errors thrown related to the connection to the Redis.
I think it is somehow related to how I am importing my client- ioredis
. I have utils/index.ts
, utils/redis.js
and inside the redis.js
I have:
const Redis = require('ioredis');
module.exports = new Redis(6380, 'MYCACHE.redis.cache.windows.net', { tls: true, password: 'PASS' });
Then I am importing this in my utils/index.ts
like so: code missing
And exporting some aysnc function like: code missing
When executing in the GCF
environment, I get the # of expected results in results.length
and I see (by monitoring the Redis internally) this list was pushed as expected to the queue.
Nevertheless, these errors continue to appear incessantly.
ioredis] Unhandled error event: Error: read ECONNRESET at _errnoException (util.js:1022:11) at TLSWrap.onread (net.js:628:25)
redis google-cloud-platform google-cloud-firestore google-cloud-functions ioredis
Hi, welcome to Stack Overflow! I've improved your question's formatting. I also noticed that you're referring to two pieces of code you forgot to add (I've replaced them with code missing). Could you please edit your question and add the missing parts?
– Federico Grandi
Nov 24 '18 at 14:03
add a comment |
I am currently running some Google Cloud functions (in typescript) that require a connection to a Redis instance in order to LPUSH
into the queue (on other instances, I am using Redis as a queue worker).
Everything is fine, except I am getting a huge number of ECONNECTRESET
and ECONNECTIMEOUT
related errors despite everything working properly.
The following code can execute successfully on the cloud function but still, I am seeing constant errors thrown related to the connection to the Redis.
I think it is somehow related to how I am importing my client- ioredis
. I have utils/index.ts
, utils/redis.js
and inside the redis.js
I have:
const Redis = require('ioredis');
module.exports = new Redis(6380, 'MYCACHE.redis.cache.windows.net', { tls: true, password: 'PASS' });
Then I am importing this in my utils/index.ts
like so: code missing
And exporting some aysnc function like: code missing
When executing in the GCF
environment, I get the # of expected results in results.length
and I see (by monitoring the Redis internally) this list was pushed as expected to the queue.
Nevertheless, these errors continue to appear incessantly.
ioredis] Unhandled error event: Error: read ECONNRESET at _errnoException (util.js:1022:11) at TLSWrap.onread (net.js:628:25)
redis google-cloud-platform google-cloud-firestore google-cloud-functions ioredis
I am currently running some Google Cloud functions (in typescript) that require a connection to a Redis instance in order to LPUSH
into the queue (on other instances, I am using Redis as a queue worker).
Everything is fine, except I am getting a huge number of ECONNECTRESET
and ECONNECTIMEOUT
related errors despite everything working properly.
The following code can execute successfully on the cloud function but still, I am seeing constant errors thrown related to the connection to the Redis.
I think it is somehow related to how I am importing my client- ioredis
. I have utils/index.ts
, utils/redis.js
and inside the redis.js
I have:
const Redis = require('ioredis');
module.exports = new Redis(6380, 'MYCACHE.redis.cache.windows.net', { tls: true, password: 'PASS' });
Then I am importing this in my utils/index.ts
like so: code missing
And exporting some aysnc function like: code missing
When executing in the GCF
environment, I get the # of expected results in results.length
and I see (by monitoring the Redis internally) this list was pushed as expected to the queue.
Nevertheless, these errors continue to appear incessantly.
ioredis] Unhandled error event: Error: read ECONNRESET at _errnoException (util.js:1022:11) at TLSWrap.onread (net.js:628:25)
redis google-cloud-platform google-cloud-firestore google-cloud-functions ioredis
redis google-cloud-platform google-cloud-firestore google-cloud-functions ioredis
edited Nov 24 '18 at 14:03
Federico Grandi
3,31331230
3,31331230
asked Nov 23 '18 at 23:59
NicoNico
13
13
Hi, welcome to Stack Overflow! I've improved your question's formatting. I also noticed that you're referring to two pieces of code you forgot to add (I've replaced them with code missing). Could you please edit your question and add the missing parts?
– Federico Grandi
Nov 24 '18 at 14:03
add a comment |
Hi, welcome to Stack Overflow! I've improved your question's formatting. I also noticed that you're referring to two pieces of code you forgot to add (I've replaced them with code missing). Could you please edit your question and add the missing parts?
– Federico Grandi
Nov 24 '18 at 14:03
Hi, welcome to Stack Overflow! I've improved your question's formatting. I also noticed that you're referring to two pieces of code you forgot to add (I've replaced them with code missing). Could you please edit your question and add the missing parts?
– Federico Grandi
Nov 24 '18 at 14:03
Hi, welcome to Stack Overflow! I've improved your question's formatting. I also noticed that you're referring to two pieces of code you forgot to add (I've replaced them with code missing). Could you please edit your question and add the missing parts?
– Federico Grandi
Nov 24 '18 at 14:03
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454045%2fhow-to-connect-ioredis-to-google-cloud-function%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
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454045%2fhow-to-connect-ioredis-to-google-cloud-function%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
Hi, welcome to Stack Overflow! I've improved your question's formatting. I also noticed that you're referring to two pieces of code you forgot to add (I've replaced them with code missing). Could you please edit your question and add the missing parts?
– Federico Grandi
Nov 24 '18 at 14:03