code-for-nashville/glean-tennessee-web

Emails not sending

Closed this issue · 6 comments

Somewhere between the firebase functions and the sendgrid setup, emails are not being sent.

It looks like the firebase function is not being invoked (last invocation was 6/29, rather than today). There may be other issues, but this is the first stopping point.
Is it possible that we disrupted the functions with the most recent deploy?
Before we changed the emails to the actual recipients (Jeannie and her staff), they were sending okay (to sosa.glean.tn@gmail.com). I tried today to set it back to sending just to that address and that is also not working (functions not being invoked)

@coreyar's observations on this:

I poked around a bit in the app to see why the firebase function wasn’t functioning properly. I noticed that the page seems to be refreshing on submit. This means that the browser is making a post request to the current url. We don’t want this. We want to control the form submission and send a request to a different url.

I confirmed @coreyar's experience. Specifically, from the login screen, you can click to go to the signup screen, but clicking the "Submit" button on the signup screen goes nowhere. I don't know React, but I inspected the code and the (possibly insignificant) difference I found was that login had a couple lines at the top of the onSubmit function that didn't exist in the onSubmit of the signup page.

login: https://github.com/code-for-nashville/glean-tennessee-web/blob/master/src/screens/login/index.js#L30

  onSubmit = async e => {
    e.preventDefault()
    const {email, password} = this.state
if (email && password) {

I'm guessing this preventDefault function is what @coreyar means by

We want to control the form submission and send a request to a different url.

But idk.

preventdefault prevents the default form submission behavior which is what we want to do. It could be that this function isn't getting fired at all.

This makes sense. So we need to prevent the default behavior of the submit button; do you think this will fix the problem and allow the firebase function to fire? I saw the firebase logs from 7/4 with the function being called.
Should I make this change and open a PR, or is it already part of something else?

It looks like there is an e.preventDefault() on line 149 of the profile form, which is the first line of the onSubmit function there. I'm thinking that may need to be moved or duplicated on the next level up, at the submit button itself?