VizAlerts icon indicating copy to clipboard operation
VizAlerts copied to clipboard

'AttributeError' object has no attribute 'message' error when downloading alert CSV

Open jdrummey opened this issue 1 year ago • 2 comments

Occasionally we're getting failures on SMS alerts where it seems like something's gone wrong in the download of the alert CSV, here's the email we're getting:

The following errors were encountered trying to process your alert:

General errors:

Unable to process alert [alert view name] as csv, error: 'AttributeError' object has no attribute 'message'

Alert Information:

View URL: https://[tableau server]/t/[site URL stub]/views/[workbook URL stub]/[alert view URL stub]
Subscriber: [subscriber username] w/mailto link
View Owner: [owner username] w/mailto link
Site Id: [site name]
Project: [project name]

When I paste in the alert view URL manually with the .csv extension to download the file I'm getting just one record (when there are ~144 records). When I edit the view to remove that record I end up getting two copies of the file when I download it so I'm really not sure what's going on.

jdrummey avatar Mar 28 '23 13:03 jdrummey

Weird...is it a multi-sheet dashboard, or a single-sheet standalone view? Sounds like it is either a Tableau Server bug, or (if a multi-sheet), possibly a behavior change?

mcoles avatar Mar 29 '23 20:03 mcoles

this is happening in the sms_number_to_e164 function in smsaction.py. when an invalid smsnumber is detected, a UserWarning is raised which is caught by the except at line 312. in the except, the logger tries to log "e.message". however, there's no message attribute for the UserWarning class. as a result, another exception is thrown: error: 'AttributeError' object has no attribute 'message'. i believe changing line 313 to log.logger.error(e) would fix the issue.

270  def smsnumber_to_e164(smsnumber, iso2countrycode):
271      """Tries to convert a string into an E.164 formatted phone number
272         Raises exception if it can't, returns the E.164 number as a string, if it can """
273  
274      try:
275          log.logger.debug('Converting {} to E.164 format, country code {}'.format(smsnumber, iso2countrycode))
...
298          if not phonenumbers.is_valid_number(smsnumber_obj):
299              errormessage = 'SMS Number is not valid: {}.'.format(smsnumber)
300              log.logger.error(errormessage)
301              raise UserWarning(errormessage)
...
310          # all good, return it!
311          return e164_number
312      except Exception as e:
313          log.logger.error(e.message)
314          return None

dwalker3rd avatar Mar 07 '24 14:03 dwalker3rd