StateVoicesNational / Spoke

mass-contact text/SMS distribution tool
Other
464 stars 405 forks source link

Bug: Campaign Export Data feature broken #2059

Open markyv18 opened 2 years ago

markyv18 commented 2 years ago

NEW/UPDATE We figured this out!... sorta. So we've got an update for this ticket.

We never had a repo hooked up to our account and that was the source of the failure to see a link appear. Once we did hook up AWS (or S3, can't remember) a link did appear and we were able to grab the data.

New request: please throw up a notification error if there is no data repo linked yet so as to inform the user as to what they need to fix instead of just wondering why nothing is working :) Thanks!

Describe the bug We need to export data, especially the "opt outs" to determine who not to text in the future and despite clicking "export data" and reloading the page, a download link never appears.

The console is showing some odd errors that i dont understand (see screenshot). Like why is it listing Twilio error codes when i click "export data"

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Campaigns'
  2. Click on 'an individual campaign'
  3. Click on 'Export Data'
  4. Refresh page
  5. ___ (nothing... no link where there should be one... even after waiting a few minutes)

Expected behavior I would expect a link to download a file would appear.

Screenshots If applicable, add screenshots to help explain your problem.

Platform (please complete the following information):

Additional context Add any other context about the problem here.

Screen Shot 2021-10-14 at 3 29 45 PM Screen Shot 2021-10-14 at 3 31 55 PM
Arique1104 commented 2 years ago

POSSIBLE SQL WORKAROUND Context: Currently, due to this button being down, many organizations have had difficulty accessing their database, especially when it pertains to the CSV download feature. While we work to debug this button, here is a Heroku Deployment workaround for accessing a csv document.

Example 1

SELECT COUNT(*)
FROM campaign_contact 
WHERE campaign_id = 3

Example 2

SELECT "message".*
FROM message
JOIN campaign_contact
ON campaign_contact.campaign_id = 3 AND message.campaign_contact_id = campaign_contact.id

Note Don't end your sql queries with a semicolon ; within this UI

For more examples on queries, please checkout Texter Activity Queries Reference Guide

markyv18 commented 2 years ago

We ended up figuring out the issue. It's a big "no duh" so i'll update the original ticket to reflect that.

We hadn't yet hooked up an AWS repo to the account so there was nowhere for the data to get sent to but when the export failed we would not receive a reason as to why.

Once we hooked up an account we were able to export data. Just would have been nice to get a notice at the top of the screen as to why the failure was happening.

Arique1104 commented 2 years ago

Hey Mark! Thanks for looking into this! I'm thinking the next step is to get an issue-ticket up to create an error-message handler so that folks can be explicitly encouraged to hook up an AWS repo.

On Mon, Feb 14, 2022 at 4:54 PM Mark Van Akkeren @.***> wrote:

We ended up figuring out the issue. It's a big "no duh" so i'll update the original ticket to reflect that.

We hadn't yet hooked up an AWS repo to the account so there was nowhere for the data to get sent to but when the export failed we would not receive a reason as to why.

Once we hooked up an account we were able to export data. Just would have been nice to get a notice at the top of the screen as to why the failure was happening.

— Reply to this email directly, view it on GitHub https://github.com/MoveOnOrg/Spoke/issues/2059#issuecomment-1039695242, or unsubscribe https://github.com/notifications/unsubscribe-auth/AONX2HDE2FLC6VSHOWCLDKDU3GI2DANCNFSM5GAUKB6Q . You are receiving this because you commented.Message ID: @.***>

markyv18 commented 2 years ago

will do! Thanks!

joemcl commented 2 years ago

Hi @markyv18 .

When you write above that y'all 'hooked up an AWS repo to the account' - do you mean you had to connect to an AWS S3 bucket, via adding the connection info to your env/config settings, to have a place to send the exports? And did y'all use AWS S3 connection directly in the config, or, are you using Bucketeer to connect to/provision an AWS S3 bucket?

Thanks!

markyv18 commented 2 years ago

Thank you for clearing up the language! Yes, we hooked up an S3 bucket directly in the config to dump the data into. Appreciate it! :)

joemcl commented 2 years ago

Thank you for clearing up the language! Yes, we hooked up an S3 bucket directly in the config to dump the data into. Appreciate it! :)

You're welcome, just wanted to make sure I wasn't missing something.

And are y'all running Spoke on Heroku, or on AWS? I ask because I'm having a problem with exports and I'm running Spoke on Heroku.

markyv18 commented 2 years ago

We're running it on Heroku.

On Thu, Mar 17, 2022 at 2:41 PM Joe McLaughlin @.***> wrote:

Thank you for clearing up the language! Yes, we hooked up an S3 bucket directly in the config to dump the data into. Appreciate it! :)

You're welcome, just wanted to make sure I wasn't missing something.

And are y'all running Spoke on Heroku, or on AWS? I ask because I'm having a problem with exports and I'm running Spoke on Heroku.

— Reply to this email directly, view it on GitHub https://github.com/MoveOnOrg/Spoke/issues/2059#issuecomment-1071419933, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEHC7TVBE3A2UNMT4RGEVULVAOKGNANCNFSM5GAUKB6Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

joemcl commented 2 years ago

thanks @markyv18 I figured out my problem with exports - I had to copy over the Bucketeer values to the default AWS values in config, and now exports are working, at least in the UI . I just re-read the HOWTO_DATA_EXPORTING doc https://github.com/MoveOnOrg/Spoke/blob/main/docs/HOWTO_DATA_EXPORTING.md

Bucketeer setup
Skip this section if you have set up your own S3 bucket.

Provision the Bucketeer add-on. Use the Heroku CLI (instructions here) or the Heroku dashboard. You can migrate between plans at any time with no downtime.
Modify the default environment variables. Bucketeer sets the following environment variables:
BUCKETEER_AWS_ACCESS_KEY_ID
BUCKETEER_AWS_SECRET_ACCESS_KEY
BUCKETEER_BUCKET_NAME
Spoke, however, expects these names:

AWS_ACCESS_KEY_ID
AWS_S3_BUCKET_NAME
AWS_SECRET_ACCESS_KEY
You can change the names in the dashboard or via the CLI. heroku config:edit will open all environment variables in an interactive editor.

but, it is not as obvious as it could or should be, at least to me, so I'm doing a PR to update the doc. I left the Bucketeer settings alone, and just copied over the values to the AWS config settings. I also added a new AWS_ACCESS_AVAILABLE=1 value in config, aargh, which is not referenced in the HOWTO doc but is in the code here https://github.com/MoveOnOrg/Spoke/blob/ce5d1290a5c4ef3ea0a7d105dc839a1917545df1/src/workers/jobs.js#L858 and is also referenced in the latest environment variables doc.