'How to explicitly set a longer timeout for a Pub/Sub function?

I have something like this:

const { runWith } = require('firebase-functions');

const runtimeOptions = { timeoutSeconds: 300 };

exports.handleFunc = runWith(runtimeOptions).pubsub.topic(someTopic).onPublish(...);

However, the emulator fails with

! functions: Your function timed out after ~60s. To configure this timeout, see https://firebase.google.com/docs/functions/manage-functions#set_timeout_and_memory_allocation.

Am I doing this the right way? Is this an emulator-specific issue?

Thanks.

Edit (5-3-2022): I've found that this is a current issue with the emulator.

Check this for a workaround (FUNCTIONS_EMULATOR_TIMEOUT_SECONDS):

https://github.com/firebase/firebase-tools/issues/2837#issuecomment-1048878134



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source