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

Notifications workflow error: Email body empty on submission promoted notification #3293

Open
kepae opened this issue Dec 18, 2024 · 3 comments
Labels
Type: Bug Something isn't working

Comments

@kepae
Copy link
Collaborator

kepae commented Dec 18, 2024

Per recent staging deploy workflow:
https://github.com/responsible-ai-collaborative/aiid/actions/runs/12378897056/job/34555123176?pr=3281


Run npm run process-notifications:ci

> [email protected] process-notifications:ci
> node -r ts-node/register src/scripts/process-notifications.ts

New Incidents: No pending notifications to process.
New Entity Incidents: No pending notifications to process.
New Updated Incidents: No pending notifications to process.
{
  headers: {
    'cache-control': 'no-cache, private',
    'cf-cache-status': 'DYNAMIC',
    'cf-ray': '8f394996a958cb85-LAX',
    connection: 'close',
    'content-type': 'application/json',
    date: 'Tue, 17 Dec 2024 19:23:25 GMT',
    server: 'cloudflare',
    'strict-transport-security': 'max-age=31536000; includeSubDomains',
    'transfer-encoding': 'chunked',
    'x-apiquota-remaining': '99985',
    'x-apiquota-reset': '2024-12-18T00:00:00Z',
    'x-ratelimit-limit': '15',
    'x-ratelimit-remaining': '14'
  },
  body: {
    message: 'The email objects are required. #MS42230',
    errors: { data: [Array] }
  },
  statusCode: 422,
  message: '[Process Pending Notifications: Submission Promoted]: [Send Email]: undefined'
}

Error reported from this logic:

error.message = `[Process Pending Notifications: Submission Promoted]: ${error.message}`;

The thrown error message is undefined, but the inner JSON of the error indicates the email body wasn't set in sendEmail. Maybe something to do with locating the template? But there's a check for that...

  body: {
    message: 'The email objects are required. #MS42230',
    errors: { data: [Array] }
  }
Code Name Explanation
MS42230 The email objects are required. The request payload provided does not contain any email object. Please check the payload and contact Customer Support for more help.
@kepae kepae added the Type: Bug Something isn't working label Dec 18, 2024
@cesarvarela
Copy link
Collaborator

@kepae
I left a comment in the staging pr. This happened because Danny's user is not in the staging database.

We should not account for this in the code because it will only happen if you restore a partial database as we do from production to staging.

@kepae
Copy link
Collaborator Author

kepae commented Dec 20, 2024

Makes sense to me. Then perhaps the right behavior is at least: this error message is more detailed. But, that makes plenty of sense. We can clear the notifications from staging or restore after there are no such notifications pending.

@cesarvarela
Copy link
Collaborator

I added a check just in case because we'll deal with this occasionally when restoring from production, such as if a user gets deleted for testing purposes or someone requests it, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants