WebhooksManagerJob throws an error if a token has been refreshed

Aperta Adatta ai principianti
#2,104 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
77/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rails, ruby
Ambito
api, backend

Direzione di ricerca

L’issue rimanda alle righe 10–12 di app/jobs/shopify_app/webhooks_manager_job.rb. Leggi come il job riceve e usa il token, poi segui il modo in cui può trovare uno shop a partire da shop_domain e chiamare shop.with_shopify_session. Verifica che il job vada a buon fine quando il token dello shop viene aggiornato dopo che il job è stato messo in coda.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Issue summary

Before opening this issue, I have:

  • Upgraded to the latest version of the package
    • shopify_app version: 23.0.3
    • Ruby version: 4.0.10
    • Operating system: any/all
  • Set log_level: :debug in my configuration, if applicable
  • Found a reliable way to reproduce the problem that indicates it's a problem with the package
  • Looked for similar issues in this repository
  • Checked that this isn't an issue with a Shopify API

After migrating to using expiring access tokens I'm seeing ShopifyAPI::Errors::HttpResponseError thrown from ShopifyApp::WebhooksManagerJob. The issue seems to be that the job is queued with a particular token, and then if the shop token is refreshed before the job executes the token passed to the job is no longer valid.

Expected behavior

It should be able to run after a token has been refreshed.

This is the problematic code block:

https://github.com/Shopify/shopify_app/blob/0341b31fc25572f5f4914e51853eb01597954e72/app/jobs/shopify_app/webhooks_manager_job.rb#L10-L12

Instead of relying on a passed token, it should look up the shop using the shop_domain that is passed in, and then use shop.with_shopify_session.

Actual behavior

It tried to use a token that is no longer valid.

Steps to reproduce the problem

  1. Queue a ShopifyApp::WebhooksManagerJob with no workers running
  2. Allow sufficient time to pass
  3. Start a worker
  4. Get a ShopifyAPI::Errors::HttpResponseError
Lingua principale
Ruby
Stelle
2k
Fork
743
Merge medio
7h 57m
PR unite (30g)
4

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Shopify/shopify_app

Tutte le issue di Shopify/shopify_app

Issue simili

Altre issue su Ruby

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.