I figured out from another thread that it was firing three times because I wasn’t doing return { statusCode: 200 } in the handler function.
It’s still not doing the post-to-Mastodon part, but I think that might be due to a timeout when trying to connect to Mastodon. I don’t know why it’s only happening on Netlify and not locally, though.