trakanom / Portfolio-Site

Under construction
0 stars 0 forks source link

'Send Request' Button Not Working in HireMeModal #6

Open trakanom opened 1 year ago

trakanom commented 1 year ago

Issue: 'Send Request' Button Not Working in HireMeModal

Description:

The 'Send Request' button in the HireMeModal component does not currently send an email when clicked. This functionality is crucial for potential clients or employers to contact the portfolio owner directly through the website.

Suggested Fixes:

  1. Integrate Backend Email Server:

    • Implement a backend server using Django (or another backend framework) to handle email sending functionality.
    • Ensure the server is configured to use SMTP to send emails and expose an API endpoint that the React app can call to trigger the email sending.
    • The React app should make a POST request to this endpoint with the email data (recipient, subject, message) when the 'Send Request' button is clicked.
  2. Use a Third-Party Email Sending Service:

    • Consider using a third-party email sending service like SendGrid, Mailgun, or AWS SES.
    • These services usually provide APIs that you can call directly from your React app to send emails.
    • Ensure to secure your API keys using environment variables and not expose them in the client-side code.
  3. Use a Serverless Function:

    • Implement a serverless function using platforms like Vercel, Netlify Functions, or AWS Lambda to handle email sending.
    • The function should be triggered by a POST request from the React app and send an email using an SMTP server or a third-party email sending service.
    • This approach allows you to have a backend functionality without managing a full backend server.

Additional Notes:

Priority: High

This functionality is crucial for communication through the portfolio website and should be implemented and tested thoroughly to ensure reliability and security.

Feel free to adjust the content as per your requirements and then submit the issue. This will help you keep track of this task and also allow others to contribute or provide solutions. If you have any other questions or need further assistance, feel free to ask!

trakanom commented 1 year ago

1. Integrate Backend Email Server (e.g., Django)

2. Use a Third-Party Email Sending Service (e.g., SendGrid, Mailgun)

3. Use a Serverless Function (e.g., Vercel, Netlify Functions, AWS Lambda)

Additional Notes:

Conclusion:

trakanom commented 1 year ago

Implementing Serverless Function on GCP

Step 1: Set Up GCP Account

Step 2: Create a Cloud Function

Step 3: Implement Frontend Logic

Step 4: Secure and Test

Building a Django Backend (#1)

While the serverless function is operational and handling your email requests, you can start building a more comprehensive backend using Django.

Step 1: Develop Locally

Step 2: Database Integration

Step 3: Deploy on GCP

Step 4: Domain and SSL

Step 5: Test and Optimize

Transitioning

Once your Django backend is ready and deployed:

Note

This approach allows you to have an operational email-sending feature using GCP Cloud Functions while concurrently developing a more robust backend with Django.

trakanom commented 1 year ago

Attempts Made:

  1. Code Adjustment: Ensured that the cloud function is correctly set up with Express and Nodemailer, and the function is exported correctly.

  2. Dependencies Check: Verified that all dependencies (Express, Nodemailer, Cors) are installed and updated to the latest versions.

  3. Testing: Attempted to test the function through the GCP console, encountering a TypeError: stream.listeners is not a function error.

  4. Local Testing: [If done, describe the results. If not done, this step is pending.]

  5. Log Analysis: Checked GCP logs for error details and found a TypeError related to stream listeners.

Next Steps:

  1. Local Testing: If not done already, test the function locally using the Functions Framework to identify if the issue persists in a local environment.

  2. Deep Dive into Error: Investigate the specific TypeError encountered in the logs to understand if it’s related to the codebase or the environment.

  3. Community/Support Query: Consider posting the issue in relevant forums or GCP support with specific error details for insights or solutions from the community or support team.

  4. Alternative Solutions: Explore alternative methods for sending emails, such as using different Nodemailer transports or using a different email sending service/API.

  5. Environment Check: Ensure that the Node.js environment and GCP configurations (like memory allocation) are optimal for the function’s operation