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

Panic when listing notifications if project doesn't exist #322

Closed
shreddedbacon opened this issue Mar 12, 2024 · 0 comments · Fixed by #323
Closed

Panic when listing notifications if project doesn't exist #322

shreddedbacon opened this issue Mar 12, 2024 · 0 comments · Fixed by #323
Assignees

Comments

@shreddedbacon
Copy link
Member

When attempting to list notifications for a project, if the project doesn't exist (eg, accidental typo of a project name), the returned data does not contain an error, just a null payload.

{"data":{"projectByName":null}}

When this is called https://github.com/uselagoon/lagoon-cli/blob/main/cmd/notificationsslack.go#L175, the data for result is empty, and result.Notifications is nil which when it tries to iterate over, results in a panic.

Unfortunately the projectByName resolver doesn't seem to return an error if a project doesn't exist :hide-the-pain:
A quick one would be to check that results.Notifications is not nil, and potentially update the query in machinery to also request the name and id fields to check if a project is returned.

This occurs on all list project notifications, not just slack.

shreddedbacon added a commit that referenced this issue Mar 20, 2024
…ifications found (#322) (#323)

* Included logic checks if project doesn't exist or no notifications found

* Upgraded to latest machinery

---------

Co-authored-by: Ben Jackson <shreddedbacon@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants