Shopify / Shopify/shopify_app

`with_lock` causing lots of errors and`perform_token_refresh!` should use atomic save

Open
#2,075 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

devtools-gardener
Dominant language
Ruby
Stars
1.9k
Forks
739
Avg merge
21h 2m
Merged PRs (30d)
1

Description

Issue summary

In Mongoid 9.0, when .refresh_token_if_expired! is called, error is raised "undefined method with_lock' for an instance of Shop (NoMethodError)". with_lock` seems to be a method in ActiveRecord but Mongoid doesn't implement ActiveRecord.

Before opening this issue, I have:

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

Expected behavior

No error raised

What do you think should happen?

Actual behavior

What actually happens?

Steps to reproduce the problem

Debug logs

// Paste any relevant logs here

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the implementation of refresh_token_if_expired! and perform_token_refresh!, then inspect how with_lock is used and how token persistence currently works for Mongoid models. Reproduce the failure with a Mongoid model and verify that refresh succeeds without with_lock while the token update is saved atomically.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
authentication, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.