PUN OpGetRegions with correct AppID fails with Missing value 224 (GetRegionListRequest.ApplicationId

Options
We're using PUN+ 1.76, everything works fine for connecting to regional servers and playing MP games.

But when we try to get the region list by calling PhotonNetwork.networkingPeer.OpGetRegions() it always fails with this error:
Operation failed: OperationResponse 220: ReturnCode: -2 (Missing value 224 (GetRegionListRequest.ApplicationId)
). Parameters: {} Server: NameServer
Our steps:
  • - PhotonNetwork.networkingPeer.ConnectToNameServer()
  • - Wait for PhotonNetwork.connectionStateDetailed == ClientState.ConnectedToNameServer
  • - log PhotonNetwork.PhotonServerSettings.AppID to confirm it is set and correct (it is)
  • - PhotonNetwork.networkingPeer.OpGetRegions(PhotonNetwork.PhotonServerSettings.AppID)
  • - PUN logs the error noted above
btw we get the same error if we call other higher level methods while connected to name server, e.g. PhotonNetwork.ConnectToBestCloudServer()

The code for OpGetRegions() is simple and I can see it sets the AppID param:
parameters[(byte)ParameterCode.ApplicationId] = appId;
so no idea what to try next. Is this a server bug? Something we are doing wrong which is giving a confusing error response?

Thanks for help!

Comments

  • Tobias
    Tobias admin
    edited October 2016
    Options
    I did a little script to reproduce this and could make it work.
    Most likely, you didn't set the AppId (which is in the settings but not in the NetworkingPeer, unless you ConnectUsingSettings()).

    Use this as reference:
    
    using UnityEngine;
    using System.Collections;
    using Photon;
    
    public class ConnectAndGetRegions : PunBehaviour {
    
    	// Use this for initialization
    	void Start ()
        {
            PhotonNetwork.networkingPeer.AppId = PhotonNetwork.PhotonServerSettings.AppID;
    	    PhotonNetwork.networkingPeer.ConnectToNameServer();
    	}
    
        public override void OnConnectedToPhoton()
        {
            PhotonNetwork.networkingPeer.GetRegions();
        }
    
        void Update()
        {
            if (PhotonNetwork.networkingPeer.AvailableRegions != null && PhotonNetwork.networkingPeer.AvailableRegions.Count > 0)
            {
                Debug.Log("PhotonNetwork.networkingPeer.AvailableRegions.Count: " + PhotonNetwork.networkingPeer.AvailableRegions.Count);
                this.enabled = false;
            }
        }
    }
    
  • Tobias
    Options
  • mwk888
    Options
    Thanks, yes I added this before I connected to name server:
    PhotonNetwork.networkingPeer.AppId = PhotonNetwork.PhotonServerSettings.AppID;
    
    and it works now
  • prawinb
    Options
    Hi,

    I am using PUN 2 in latest version of UFE (Universal Fighting Engine). When I am playing online game, I am getting following error,
    GetRegions failed. Can't provide regions list. ReturnCode: -2: Empty application id
    

    Could you please help me to resolve this issue.
  • Tobias
    Options
    Please read the error message fully. Then check your application id.
    The docs will tell you how to set up your app.

  • prawinb
    prawinb
    edited March 2021
    Options
    Thank you for the reply. I am getting following full error message.
    .
    GetRegions failed. Can't provide regions list. ReturnCode: -2: Empty application id
    UnityEngine.Debug:LogError (object)
    Photon.Realtime.LoadBalancingClient:DebugReturn (ExitGames.Client.Photon.DebugLevel,string) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2504)
    Photon.Realtime.LoadBalancingClient:OnOperationResponse (ExitGames.Client.Photon.OperationResponse) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2734)
    ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback (ExitGames.Client.Photon.StreamBuffer) (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/PeerBase.cs:864)
    ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands () (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/EnetPeer.cs:559)
    ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands () (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/PhotonPeer.cs:1837)
    Photon.Pun.PhotonHandler:Dispatch () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:223)
    Photon.Pun.PhotonHandler:FixedUpdate () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:149)
    

    I have added App Id in Photon Server Settings, but still I am getting above error. I am using photon cloud in our project.