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

onSuccess callback not working after deployment. #46

Open
kalib-code opened this issue Dec 19, 2022 · 0 comments
Open

onSuccess callback not working after deployment. #46

kalib-code opened this issue Dec 19, 2022 · 0 comments

Comments

@kalib-code
Copy link

Hi, I got a problem with the onSuccess callback. if I am on local the callback triggers and I can see the response but after I deploy it on AWS amplify its no longer working. I wanted to send an email invite every time a new user is being added turns out that on my local it's working but after being deployed it's not working anymore.

` onSuccess : async ( req, res, options ) => {

        if (req.method === 'POST') {
            const { email, role, companies : { connect : { id : cid } } } = req.body

            if (role !== 'USER') return

            // get user details from db
            const user = await prisma.user.findUnique ( {
                where : {
                    email : email
                },
            } ) as Prisma.UserCreateInput

            if (req.query.nextcrud.includes ( 'users' )) {

                console.log("[email] sending email to ", email)
                const emailData = {
                    Recipients : {
                        To : [email] // maximum 50 recipients
                    },
                    Content : {
                        Body : [
                            {
                                ContentType : "HTML",
                                Charset : "utf-8",
                                Content : `message `
                            },
                            {
                                ContentType : "PlainText",
                                Charset : "utf-8",
                                Content : `message`
                            }
                        ],
                        From : "[email protected]",
                        Subject : "Video Thread Invitation"
                    }
                }


                try{
                    // @ts-ignore
                    const { data } = await sendTransactionalEmails ( emailData as EmailTransactionalMessageData )
                    console.log("[EMAIL]-[SUCCESS] ", data)
                }catch (e) {
                    console.log("[email] error sending email", e)
                }




            }
        }

    }`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant