`with_lock` causing lots of errors and`perform_token_refresh!` should use atomic save
Nobody has claimed this yet.
- 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_appversion: 23.0- Ruby version: 3.3.6
- Operating system:
- [ x] Set
log_level: :debugin 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
- If it is, please create a post in the Shopify community forums or report it to Shopify Partner Support
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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