Social service invite system gives long error

I’m having an error with the social service invite system. The code I’m using works, but throws this long error.

Script (Just an example, but gives the same error as my real script.)
local players = game:GetService("Players")
local socialService = game:GetService("SocialService")
local player = players.LocalPlayer

local function doInvite()
	local success, result = pcall(
		function()
			return socialService:CanSendGameInviteAsync(player)
		end
	)

	if result == true then
		socialService:PromptGameInvite(player)
	end	
end

wait(10)
doInvite()
Output
18:14:15.114  CorePackages.AppTempCommon.LuaChat.Utils.getFriendsActiveGamesPlaceIdsFromUsersPresence:12: attempt to index nil with number  -  Client - lua-promise:16

18:14:15.160  Unhandled promise rejection:
CorePackages.AppTempCommon.LuaChat.Utils.getFriendsActiveGamesPlaceIdsFromUsersPresence:12: attempt to index nil with number
CorePackages.Packages._Index.lua-promise.lua-promise:82 function new
CorePackages.Packages._Index.lua-promise.lua-promise:222 function andThen
CoreGui.RobloxGui.Modules.Settings.Pages.ShareGame.Thunks.ApiFetchUsersFriends:28
CorePackages.Packages._Index.roblox_rodux.rodux.thunkMiddleware:10
CorePackages.Packages._Index.roblox_rodux.rodux.Store:62
CoreGui.RobloxGui.Modules.Settings.Pages.ShareGame.Thunks.FetchUserFriends:19
CorePackages.Packages._Index.roblox_rodux.rodux.thunkMiddleware:10
CorePackages.Packages._Index.roblox_rodux.rodux.Store:62
CorePackages.Packages._Index.roblox_roact-rodux.roact-rodux.connect:149
CoreGui.RobloxGui.Modules.Settings.Pages.ShareGame.Components.ShareGameContainer:55
CoreGui.RobloxGui.Modules.Settings.Pages.ShareGame.Components.ShareGameContainer:30 function init
CorePackages.Packages._Index.roblox_roact.roact.Component:323 function __mount
CorePackages.Packages._Index.roblox_roact.roact.createReconciler:363 function mountVirtualNode
CorePackages.Packages._Index.roblox_roact.roact.createReconciler:93 function updateChildren
CorePackages.Packages._Index.roblox_roact.roact.createReconciler:119 function updateVirtualNodeWithRenderResult
CorePackages.Packages._Index.roblox_roact.roact.Component:334 function __mount
CorePackages.Packages._Index.roblox_roact.roact.createReconciler:363 function mountVirtualNode
CorePackages.Packages._Index.roblox_roact.roact.createReconciler:93 function updateChildren
CorePackages.Packages._Index.roblox_roact.roact.createReconciler:119 function updateVirtualNodeWithRenderResult
CorePackages.Packages._Index.roblox_roact.roact.Component:334 function __mount
CorePackages.Packages._Index.roblox_roact.roact.createReconciler:363 function mountVirtualNode
CorePackages.Packages._Index.roblox_roact.roact.createReconciler:93 function updateChildren
CorePackages.Packages._Index.roblox_roact.roact.createReconciler:119 function updateVirtualNodeWithRenderResult
CorePackages.Packages._Index.roblox_roact.roact.Component:334 function __mount
CorePackages.Packages._Index.roblox_roact.roact.createReconciler:363 function mountVirtualNode
CorePackages.Packages._Index.roblox_roact.roact.createReconciler:93 function updateChildren
CorePackages.Packages._Index.roblox_roact.roact.createReconciler:111 function updateVirtualNodeWithChildren
CorePackages.Packages._Index.roblox_roact.roact.RobloxRenderer:215 function mountHostNode
CorePackages.Packages._Index.roblox_roact.roact.createReconciler:359 function mountVirtualNode
CorePackages.Packages._Index.roblox_roact.roact.createReconciler:93 function updateChildren
CorePackages.Packages._Index.roblox_roact.roact.createReconciler:119 function updateVirtualNodeWithRenderResult
CorePackages.Packages._Index.roblox_roact.roact.Component:334 function __mount
CorePackages.Packages._Index.roblox_roact.roact.createReconciler:363 function mountVirtualNode
CorePackages.Packages._Index.roblox_roact.roact.createReconciler:93 function updateChildren
CorePackages.Packages._Index.roblox_roact.roact.createReconciler:119 function updateVirtualNodeWithRenderResult
CorePackages.Packages._Index.roblox_roact.roact.Component:334 function __mount
CorePackages.Packages._Index.roblox_roact.roact.createReconciler:363 function mountVirtualNode
CorePackages.Packages._Index.roblox_roact.roact.createReconciler:399 function mountVirtualTree
CoreGui.RobloxGui.Modules.Settings.Pages.ShareGame.InviteToGamePrompt:71 function show
CoreGui.RobloxGui.CoreScripts/InviteToGamePrompt:42
 -  Client - lua-promise:361

I’ve looked around and found nothing.

Any help would be appreciated. Thanks for reading

The script looks standalone but the error says you are using Promise, which is erroring when you are using it.

How do you think I fix this? Is this a problem on my or roblox’s end?

Well, I’ve never used promise but I’m pretty sure it’s your fault. It’s not related to the SocialService though.

I haven’t ever used promise and this happens on a clean place. Place link: test - Roblox

They I would say that you can ignore it, but I’m worried you might have a plugin that is either erroring or adding a malicious script somewhere that you don’t know about. I would do a search for “getfenv” and “require” in all scripts to see if anything comes up.

I just made that place. I’ll uninstall my plugins and remake it so I know it’s not a plugin.

Just redid it. I forgot to make the place public sorry. I’m still getting the error.

Yes this is on Roblox’s end, you can’t get rid of it unless you wrap it in a pcall.

1 Like

How can I report it since I don’t have access to the bug report areas?

This is my code

local function canSendGameInvite(targetPlayer)
	local res, canSend = pcall(SocialService.CanSendGameInviteAsync, SocialService, targetPlayer)
	return res and canSend
end

local function promptGameInvite(targetPlayer)
	local res, canInvite = pcall(SocialService.PromptGameInvite, SocialService, targetPlayer)
	return res and canInvite
end

local function openGameInvitePrompt(targetPlayer)
	if canSendGameInvite(targetPlayer) then
		return promptGameInvite(targetPlayer)
	end
	return false
end

local function onActivated()
	openGameInvitePrompt(plr)
end

I.Activated:Connect(onActivated)
I.Visible = canSendGameInvite(plr)

It still gives that long error, where do I have to pcall? There are already some pcalls in the code above. This code was copied as it is from the developer hub.