Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue 1346 #1424

Merged
merged 3 commits into from Jun 24, 2019
Merged

Fix issue 1346 #1424

merged 3 commits into from Jun 24, 2019

Conversation

samtstern
Copy link
Contributor

Description

Fixes #1346

Scenarios Tested

exports.rtdbReaction = functions.database.ref('info/test').onWrite(async (change, ctx) => {
    console.log('========== RTDB FUNCTION ==========');
    console.log(`Change: ${JSON.stringify(change)}`);
    return true;
});
$ http PUT http://localhost:9000/info/test.json?ns=fir-dumpster "Authorization:Bearer owner" sam=stern3

I observed no errors. I also tried writing the same function but have it throw an error and everything went as expected.

Sample Commands

N/A

@googlebot googlebot added the cla: yes Manual indication that this has passed CLA. label Jun 20, 2019
@coveralls
Copy link

coveralls commented Jun 20, 2019

Coverage Status

Coverage increased (+0.009%) to 62.304% when pulling 61488ab on ss-fix-1346 into 65bb69a on master.

Copy link
Contributor

@bkendall bkendall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a reasonable fix to me... :)

new EmulatorLog("FATAL", "runtime-error", err.stack ? err.stack : err).log();
process.exit();
});
main()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not required, but, couldn't this be written:

try {
  await main();
} catch (err) {
  new EmulatorLog...
  process.exit(1);
}
// I don't know if you'd _really_ need this, but probably wouldn't hurt:
process.exit(0);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah because we can't have top-level await :-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Manual indication that this has passed CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Functions Runtime process hangs when invoked for an RTDB emulator trigger
4 participants