Skip to content

CommerceService.GetCurrent() never returns  #3572

Description

@allister-beamable

Describe the bug

When the first call to CommerceService is a GetCurrent() invocation with no scope supplied, the await never gets fulfilled.

To Reproduce

using System.Threading.Tasks;
using Beamable;
using UnityEngine;
using UnityEngine.UI;

public class ListingsGetCurrentSlow : MonoBehaviour
{
	public Button PrimaryButton;

	private BeamContext _beamable;

	private async void Start()
	{
		await InitializeBeamable();
		PrimaryButton.onClick.AddListener(OnPrimaryButtonClicked);
		Debug.Log("BeamContext ready. Go ahead and click");
	}

	private async void OnPrimaryButtonClicked()
	{
		Debug.Log("Primary button clicked");
		await GetListings();
	}

	private async Task InitializeBeamable()
	{
		_beamable = await BeamContext.Default.Instance;
	}

	private async Task GetListings()
	{
		Debug.Log("Doing GetCurrent in CommerceService");
		var storeView = await _beamable.Api.CommerceService.GetCurrent();
		Debug.Log($"Got store view with {storeView.listings.Count} listings.");
		foreach (var listingView in storeView.listings)
		{
			Debug.Log($"LISTING: {listingView.symbol}");
		}
	}
}

Expected behavior

  • await ctx.Api.CommerceService.GetCurrent(); returns fast and yields a fully populated, meaningful StoreView data structure.

Actual behavior

  • await ctx.Api.CommerceService.GetCurrent(); never returns, thereby rendering it useless.

Metadata

  • SDK version: 1.19.21
  • Engine version: Unity 2021.3.27f1
  • Operating System: macOS

Activity

  1. cdhanna commented on Aug 27, 2024

    @cdhanna
    Collaborator

    maybe it has to do with the fact that the Notify() function is only called inside the loop in CommerceService

    protected override void OnRefresh(GetOffersResponse data)
    		{
    			foreach (var store in data.stores)
    			{
    				store.Init();
    
    				Notify(store.symbol, store);
    
    				if (store.nextDeltaSeconds > 0)
    				{
    					var delta = Math.Max(store.nextDeltaSeconds, _config.CommerceListingRefreshSecondsMinimum);
    					ScheduleRefresh(delta, store.symbol);
    				}
    			}
    		}
  2. added this to the Unity 1.19.24 milestone on Aug 27, 2024
  3. allister-beamable commented on Aug 27, 2024

    @allister-beamable
    ContributorAuthor

    In the realm where I tested this, I have a couple of stores and a few listings.
    Screenshot 2024-08-27 at 09 51 55

  4. allister-beamable commented on Jul 28, 2026

    @allister-beamable
    ContributorAuthor

    Needs re-testing to see if it is still true on 6.x

  5. self-assigned this
    on Aug 6, 2026
  6. mhijaziB commented on Aug 7, 2026

    @mhijaziB
    Contributor

    Still happening. Will tackle it

  7. added theissue type on Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions