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

[bug] Saving a new Research Article Update as Draft triggers the webhook #3740

Closed
pizzaisdavid opened this issue Jul 7, 2024 · 10 comments · Fixed by #3834
Closed

[bug] Saving a new Research Article Update as Draft triggers the webhook #3740

pizzaisdavid opened this issue Jul 7, 2024 · 10 comments · Fixed by #3834

Comments

@pizzaisdavid
Copy link
Collaborator

pizzaisdavid commented Jul 7, 2024

To Reproduce
Steps to reproduce the behaviour:

  1. Start emulator backend.
  2. Start frontend for emulator.
  3. Login as precious plastic.
  4. Edit the existing Research Article.
  5. Create a new Update.
  6. Create a title, description, and add a photo.
  7. Press save as draft.
  8. Check in the command line that the webhook was triggered.

Link to emulator: https://github.com/ONEARMY/community-platform/blob/master/packages/documentation/docs/Backend%20Development/firebase-emulator.md#commands

Expected behaviour
The webhook should not be triggered.

Also, as Ben has pointed out in the comments, that if the article is a draft, it is currently also possible to trigger the webhook, which is bad mm'kay.

@pizzaisdavid
Copy link
Collaborator Author

pizzaisdavid commented Jul 7, 2024

When you fix this, it would be good to add a corresponding unit test, you can use this as a base: https://github.com/ONEARMY/community-platform/blob/master/functions/src/Integrations/firebase-discord.test.ts

@benfurber
Copy link
Member

I can accidently confirm this problem. This is a draft update on a draft research article!

Screenshot 2024-07-08 at 16 55 45

@pizzaisdavid
Copy link
Collaborator Author

@benfurber Good catch, I have updated the description.

Someone please consider adding the label Good First Issue. :)

@onim-at
Copy link
Contributor

onim-at commented Aug 20, 2024

Hello! I'd like to work on this issue
Where should I see whether the webhook was triggered or not?
In my case the backend and frontend emulator don't show any log

Details

Backend cmd

image

Frontend cmd

image

@pizzaisdavid
Copy link
Collaborator Author

Hello @onim-at, thanks for trying to take a look.

It is slightly hard to answer your question, because it is not 100% clear which commands you used.

But to answer your question. You should see it in the docker-compose terminal (the one you have labeled "Backend cmd")

Here is a video, where I re-create the bug, showing the webhook is triggered, using the latest master code and exactly what commands to run and what to do in the user interface:
https://www.youtube.com/watch?v=IqPDdR0cQjw

The documentation on the onearmy website is out-of-date (unfortunately) so best to look directly at the markdown documentation:
https://github.com/ONEARMY/community-platform/blob/master/packages/documentation/docs/Backend%20Development/firebase-emulator.md

@pizzaisdavid
Copy link
Collaborator Author

If anything is still unclear, please let me know. I realize now that the screen recording doesn't include mouse movements, which probably makes it even harder to understand.

@benfurber
Copy link
Member

Thanks for picking this up @onim-at! Good luck.

@onim-at
Copy link
Contributor

onim-at commented Aug 31, 2024

Hello @pizzaisdavid, thanks for the video explanation!
Unfortunately I didn't manage to run correctly the firebase functions as the backend emulator throws a bunch of errors

I've synched my fork to the latest master branch commit and run the following commands

# on terminal 1
yarn install
yarn run frontend:for-emulated-backend:watch 
# on terminal 2
yarn run backend:emulator:watch

However the backend raises several error, some of which are TS2307: Cannot find module 'oa-shared' or its corresponding type declarations which I guess is the reason why my local environment is not running the firebase functions
I leave attached the backend logs in case someone knows how to fix them

backend_logs.txt

On a more positive note, I've created a PR that should fix the issue but I couldn't test it due to the mentioned errors

@pizzaisdavid
Copy link
Collaborator Author

About the error, off the top of my head, I'm not sure. Which is annoying, because the Docker/backend emulator is supposed to be something nice that works for everyone.

I have looked at your pr though.

@onearmy-bot
Copy link
Collaborator

🎉 This issue has been resolved in version 1.212.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants