Code Monkey home page Code Monkey logo

Comments (7)

hpawe01 avatar hpawe01 commented on June 24, 2024

I had also some problems and had to look at the AWS Lambda CloudWatch Insight Log to figure out the specific error, because "An unexpected error occurred" is not that helpful.

My first error was, that I used the wrong SENDER_ARN (not the one from a whitelisted E-Mail address from AWS SES).
And the second error was, that I didn't had permission (in AWS Lambda) to send emails to the _to address, although I verified it (as described in the README.md). I fixed it by adding it explicitly to the serverless.yml as additional iamRoleStatement:

    - Effect: "Allow"
      Action:
        - "ses:SendEmail"
      Resource: ${file(config.json):RECIPIENT_ARN}

Hope that helps.

from formplug.

Tragio avatar Tragio commented on June 24, 2024

Hello @danielireson @hpawe01 🙂. I'm new to AWS and I'm trying to put this amazing serverless working. Hopefully, you can help me. First of all, thank you for your work and support.

I'm having An unexpected error occurred. I checked the Cloudwatch logs and I have this weird error:
cloudwatch

Here is my config.json:
configjson

Here is part of my serverless.yml:
serverless

And here is my completely simple contact form:
contactform

The SENDER_ARN is the same as the whitelist email that I'm using.

I also tried adding the same RECIPIENT_ARN to see if it solves but nothing.

What I am doing wrong?

Really thank you for your help ❤️

from formplug.

hpawe01 avatar hpawe01 commented on June 24, 2024

I am only a beneficiary of this service created by @danielireson

I don't see anything wrong with your configuration. In my ARNs the whole email address is behind the last / though and in your ARNs it looks like it is only the domain? So are you sure that you use the correct ARNs of the email addresses configured in SES?

from formplug.

Tragio avatar Tragio commented on June 24, 2024

I am only a beneficiary of this service created by @danielireson

I don't see anything wrong with your configuration. In my ARNs the whole email address is behind the last / though and in your ARNs it looks like it is only the domain? So are you sure that you use the correct ARNs of the email addresses configured in SES?

You're amazing!! ❤️ I was using domain ARN instead of email ARN. Now it's working.

However, I have this last issue. I have the hidden _to for the email I want to receive ([email protected]) and the _replyTo for the visitor email. In the whitelist, I have my email ([email protected]).

But now Formplug is verifying _replyTo if it is whitelisted `Non-whitelisted email in '_replyTo' field. How are you doing for your visitors to insert their email?

<input type="email" name="_replyTo" required />
<input type="text" name="message" required />
<input type="hidden" name="_to" value="[email protected]" />

Thank you!! 🙂

from formplug.

hpawe01 avatar hpawe01 commented on June 24, 2024

Glad I could help. I don't use this _replyTo field so I don't know how this should work. Maybe @danielireson or someone else can help with this question.

from formplug.

Tragio avatar Tragio commented on June 24, 2024

Fixed by commenting this code on Request.js 😃 Thank you all!!
Screenshot 2020-06-11 at 14 55 04

from formplug.

danielireson avatar danielireson commented on June 24, 2024

I'm going to close this as workarounds have been suggested.

It looks like there were a few different issues mentioned in this thread:

  • The configuration for WHITELISTED_RECIPIENTS was previously set to an empty array in config.sample.json by default. When creating config.json for your own deployment this value needed updating with whitelisted emails or removing. I've since changed the default so it's disabled to prevent this from happening.
  • There were IAM issues and a suggested fix was to add an extra "sendEmail" permisssion to allow RECIPIENT_ARN to send emails. I'm struggling to understand how this would have fixed anything as a recipient doesn't need to send emails. I think the fix is more likely to have been a byproduct of redeploying the service with an updated config, the wrong ARN values being used initially, or perhaps there's a small time delay when leaving SES sandbox mode (i.e. a delay after the AWS support ticket was closed).
  • There's a use-case for having non-whitelisted _replyTo emails but whitelisted _to/_cc/_bcc emails that I haven't considered. The workaround here is to either disable whitelisting or accept the visitors email as a separate field (e.g. "visitorEmail") and then compose a new email in your email client when you want to reply. This is definitely more cumbersome and if this comes up in the future I'll look at changing how this works.

from formplug.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.