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

Missing CSV file in email of report / alert #28495

Open
3 tasks done
dufour-yohann opened this issue May 14, 2024 · 1 comment
Open
3 tasks done

Missing CSV file in email of report / alert #28495

dufour-yohann opened this issue May 14, 2024 · 1 comment
Labels
alert-reports Namespace | Anything related to the Alert & Reports feature

Comments

@dufour-yohann
Copy link

dufour-yohann commented May 14, 2024

Bug description

When I receive a report or alert of a "Chart" report with "CSV" format, the CSV file is missing

How to reproduce the bug

  1. Go to a table chart edit page (url example: /explore/?form_data_key=...&slice_id=1234) of a non empty dataset : the table must contain records
  2. Click on "..." (right top corner) then "Manage email report" > "Set up an email report"
  3. Choose the name and the schedule you want, and select "Formatted CSV attached in email" in Message content then save
  4. Wait for the report to be sent (according to schedule settings)
  5. Open the email received : you can see that the email is empty (there is only the subject and a link in the email body) and no file is attached => the csv file is missing

Screenshots/recordings

image

Superset version

4.0.1

Python version

I don't know

Node version

I don't know

Browser

Chrome

Additional context

Superset is deployed on AWS ECS with a custom Dockerfile built from the official image of apache/superset:4.0.1

I have checked the logs and no error / python stacktrace are triggered

FEATURE_FLAGS = {
    'ALERT_REPORTS': True,
    'DRILL_TO_DETAIL': True,
    'ENABLE_TEMPLATE_PROCESSING': True,
    'PLAYWRIGHT_REPORTS_AND_THUMBNAILS': True,
    'EMBEDDED_SUPERSET': True
}

ALERT_REPORTS_NOTIFICATION_DRY_RUN = True
SCREENSHOT_LOCATE_WAIT = 100
SCREENSHOT_LOAD_WAIT = 600

class CeleryConfig:
    broker_url = 'redis://%s:%s/0' % (REDIS_HOST, REDIS_PORT)
    imports = ('superset.sql_lab', "superset.tasks", "superset.tasks.thumbnails", )
    result_backend = 'redis://%s:%s/0' % (REDIS_HOST, REDIS_PORT)
    worker_prefetch_multiplier = 10
    task_acks_late = True
    task_annotations = {
        'sql_lab.get_sql_results': {
            'rate_limit': '100/s',
        },
        'email_reports.send': {
            'rate_limit': '1/s',
            'time_limit': 600,
            'soft_time_limit': 600,
            'ignore_result': True,
        },
    }
    beat_schedule = {
        "reports.scheduler": {
            "task": "reports.scheduler",
            "schedule": crontab(minute="*", hour="*"),
        },
        "reports.prune_log": {
            "task": "reports.prune_log",
            "schedule": crontab(minute=10, hour=0),
        },
    }


CELERY_CONFIG = CeleryConfig

# Email configuration
SMTP_HOST = os.getenv("SMTP_HOST")
SMTP_PORT = os.getenv("SMTP_PORT")
SMTP_STARTTLS = True
SMTP_SSL_SERVER_AUTH = True # If your using an SMTP server with a valid certificate
SMTP_SSL = False
SMTP_USER = os.getenv("SMTP_USER")
SMTP_PASSWORD = os.getenv("SMTP_PASSWORD")
SMTP_MAIL_FROM = "x@yyy.com"
EMAIL_REPORTS_SUBJECT_PREFIX = ""

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
Copy link

dosubot bot commented May 14, 2024

It looks like the issue with the missing CSV file in email reports/alerts from Apache Superset might be related to the handling of attachments in the email sending process. Here are a few areas to investigate:

  1. CSV Data Generation: Ensure that the CSV content is being generated correctly. The issue might arise if self._content.csv is empty or not set, which would prevent the attachment from being included in the email.

  2. Email Sending Function: The problem could be in how the send_email_smtp function processes attachments. It's called with files=[] and data=content.data, where data should contain the CSV content. If the function doesn't handle this parameter as expected, the attachment might not be added to the email.

  3. Configuration and Logging: Check your Apache Superset and SMTP server configurations for any settings that might affect email attachments. Additionally, enabling more detailed logging in Apache Superset can provide insights. Adjust the logging level to DEBUG to capture detailed information about the email sending process, which could help identify why the CSV file isn't being attached.

To enable detailed logging, adjust the LOG_LEVEL to DEBUG in the Superset configuration file. This will increase log verbosity, providing more information on the email sending process and attachment handling. Be mindful that debug logging can generate a lot of data, so it's best used temporarily for troubleshooting.

These steps should help you narrow down the cause of the issue and find a resolution. If you discover any new details or errors in the logs, sharing those could provide further clues for troubleshooting.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

@dosubot dosubot bot added the alert-reports Namespace | Anything related to the Alert & Reports feature label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alert-reports Namespace | Anything related to the Alert & Reports feature
Projects
None yet
Development

No branches or pull requests

1 participant