I keep getting this error and not quite sure what is going on.
queueFunction
Error: Process exited with code 16
at process.<anonymous> (/layers/google.nodejs.functions-
framework/functions-framework/node_modules/@google-cloud/functions-
framework/build/src/invoker.js:275:22)
at process.emit (events.js:315:20)
at process.EventEmitter.emit (domain.js:483:12)
at process.exit (internal/process/per_thread.js:167:15)
at Object.sendCrashResponse (/layers/google.nodejs.functions-
framework/functions-framework/node_modules/@google-cloud/functions-
framework/build/src/logger.js:37:9)
at process.<anonymous> (/layers/google.nodejs.functions-
framework/functions-framework/node_modules/@google-cloud/functions-
framework/build/src/invoker.js:271:22)
at process.emit (events.js:315:20)
at process.EventEmitter.emit (domain.js:483:12)
at processPromiseRejections (internal/process/promises.js:209:33)
at processTicksAndRejections (internal/process/task_queues.js:98:32)
queueMatch
Error: Process exited with code 16
at process.<anonymous> (/layers/google.nodejs.functions-
framework/functions-framework/node_modules/@google-cloud/functions-
framework/build/src/invoker.js:275:22)
at process.emit (events.js:315:20)
at process.EventEmitter.emit (domain.js:483:12)
at process.exit (internal/process/per_thread.js:167:15)
at Object.sendCrashResponse (/layers/google.nodejs.functions-
framework/functions-framework/node_modules/@google-cloud/functions-
framework/build/src/logger.js:37:9)
at process.<anonymous> (/layers/google.nodejs.functions-
framework/functions-framework/node_modules/@google-cloud/functions-
framework/build/src/invoker.js:271:22)
at process.emit (events.js:315:20)
at process.EventEmitter.emit (domain.js:483:12)
at processPromiseRejections (internal/process/promises.js:209:33)
at processTicksAndRejections (internal/process/task_queues.js:98:32)
And this is for function I created that seems to execute sometimes and then doesn't.
exports.queueFunction = globalFunctions.runWith(runtimeOpts).https.onRequest((request, response) => {
try {
challengeId = '';
console.log("Running cron challenge...")
var timesRun = 0;
var interval = setInterval(() => {
timesRun += 1;
if (timesRun === 12) {
console.log("Stopping cron challenge interval...")
clearInterval(interval);
}
console.log("Executing challenge match...")
getChallenges();
}, 5000);
response.status(200).send({ success: 'success' });
} catch (error) {
response.status(500).send({ error: 'error' });
}
});
And the queue is simply checking is there is a match queue in a collection
db = admin.firestore();
const tourRef = db.collection('ChallengeQueue');
const snapshot = await tourRef.where('challengeId', '==', challengeId).get();
const queuedata = [];
if (snapshot.empty) {
console.log('No users online.');
return;
}
snapshot.forEach(doc => {
if (doc.id !== playerId) {
queuedata.push(doc.data());
}
});