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

Could not validate webhook HMAC #109

Closed
AmandaLutzTO opened this issue Apr 22, 2024 · 4 comments
Closed

Could not validate webhook HMAC #109

AmandaLutzTO opened this issue Apr 22, 2024 · 4 comments
Labels
bug Something isn't working Plugins → Shopify For Linear sync Plugins For Linear sync

Comments

@AmandaLutzTO
Copy link

Description

Trying to sync Shopify product changes to Craft using webhooks.

The Shopify webhook sections says "Your webhooks will be signed with ..."
This long string does not match SHOPIFY_ADMIN_ACCESS_TOKEN, SHOPIFY_API_KEY, SHOPIFY_API_SECRET_KEY, or SHOPIFY_HOSTNAME. Should it be somewhere?

Steps to reproduce

  1. Install Shopify plugin
  2. Follow instructions for set up (https://github.com/craftcms/shopify/tree/v4?tab=readme-ov-file#create-a-shopify-app)
  3. Use command for initial 400+ product sync (https://github.com/craftcms/shopify/tree/v4?tab=readme-ov-file#synchronization)
  4. Generate webhook urls and add to Shopify (https://qa.domain.ca/shopify/webhook/handle)
  5. Change Shopify product price and check logs [web.ERROR] [application] Could not validate webhook HMAC

Additional info

  • Craft version: 4.8.4
  • PHP version: 8.1.27
  • Database driver & version: MySQL 8.0.35
  • Plugins & versions: 4.1.0
@AmandaLutzTO AmandaLutzTO added bug Something isn't working Plugins For Linear sync Plugins → Shopify For Linear sync labels Apr 22, 2024
Copy link

linear bot commented Apr 22, 2024

@lukeholder
Copy link
Member

lukeholder commented Apr 24, 2024

@AmandaLutzTO

You should not create your webhooks from the shopify admin setting webhooks page.

You need to generate the webhooks from the Craft CP > Shopify > Webhooks and click 'create' while your project is in development (with a local passhthrough set up like ngrok) as well creating them in production.

This is documented here: https://github.com/craftcms/shopify?tab=readme-ov-file#set-up-webhooks

This should set up validated webhooks automatically for you.

@AmandaLutzTO
Copy link
Author

AmandaLutzTO commented Apr 24, 2024

Ah got it. Don't need to add any of the webhooks to Shopify.

I now have a "[web.ERROR] [application] Webhook handler failed with message:file_put_contents(/tmp/.last_api_deprecation_warning): Failed to open stream: Permission denied" issue but that seems like an issue for the server admin.

Thanks.

@cloudops-gkaur
Copy link

Adding to Amanda's error, we do have 777 on file /tmp/.last_api_deprecation_warning as current permissions and it still throws an error. What this temp file is used for, I just see a random numbers inside. Also here are the logs
2024-04-24 16:10:43 [web.ERROR] [application] Webhook handler failed with message:file_put_contents(/tmp/.last_api_deprecation_warning): Failed to open stream: Permission denied {"memory":32809904}
2024-04-24 16:10:45 [web.ERROR] [application] Webhook handler failed with message:file_put_contents(/tmp/.last_api_deprecation_warning): Failed to open stream: Permission denied {"memory":32815408}
2024-04-24 16:10:59 [web.ERROR] [application] Webhook handler failed with message:file_put_contents(/tmp/.last_api_deprecation_warning): Failed to open stream: Permission denied {"memory":32812816}
2024-04-24 16:11:00 [web.ERROR] [application] Webhook handler failed with message:file_put_contents(/tmp/.last_api_deprecation_warning): Failed to open stream: Permission denied {"memory":32811136}
2024-04-24 16:11:03 [web.ERROR] [application] Webhook handler failed with message:file_put_contents(/tmp/.last_api_deprecation_warning): Failed to open stream: Permission denied {"memory":32809656}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Plugins → Shopify For Linear sync Plugins For Linear sync
Projects
None yet
Development

No branches or pull requests

3 participants