Internal error while fetching asset type because MarketplaceService:getProductInfo() failed because HTTP 400 (Bad Request)

After multiple hours of trying to fix this issue I’ve come to no definitive conclusion and I’m wondering if anybody here in the DevForum might be able to offer some support.

The title of this post is the error I get in the Developer Console upon clicking a button within my game to purchase an outfit:

Internal error while fetching asset type because MarketplaceService:getProductInfo() failed because HTTP 400 (Bad Request)

Let me walk you through all the steps that my game does to this point.


By going into this GUI, you can access buttons to buy the shirt on display. The IDs for the assets being sold are located within each of the models in NumberValues, and then as each model is clicked, are sent to two values in the GUI so that the buttons can access them, like so:

Snippet from LocalScript inside StarterPlayerScripts

for _,v in pairs(workspace.ClothingModels:GetChildren()) do
	if v:IsA("Model") then

		v.ShirtPart.ClickDetector.MouseClick:connect(function(player)
			-- If you click a part called 'ShirtPart' inside of the model...
			purchaseGui.Visible = true -- GUI becomes visible
			
			purchaseGui.ShirtValue.Value = v.ShirtValue.Value
			purchaseGui.PantsValue.Value = v.PantsValue.Value
			-- Values of the shirts and pants transfer over to the GUI		
		end)
	end
end

Snippet from LocalScript inside of PurchaseGui

shirtButton.MouseButton1Down:Connect(function(player)
	PromptPurchaseEvent:FireServer(player, frame.ShirtValue.Value)
end)

pantsButton.MouseButton1Down:Connect(function(player)
	PromptPurchaseEvent:FireServer(player, frame.PantsValue.Value)
end)
-- Upon clicking the 'Buy Shirt' or 'Buy Pants' buttons, it prompts a purchase

Snippet from server script inside ServerScriptServices

local PromptPurchaseEvent = Remotes.PromptPurchaseEvent

PromptPurchaseEvent.OnServerEvent:Connect(function(player, id)
	MarketplaceService:PromptPurchase(player, id)
end)

So that’s that. There you have all the code building up to this point. I’ll show you some other relevant screenshots…


This shows that the value does indeed transfer over from the model.

image
Security.


Developer console in a local server.

(Incidentally, the developer console is completely blank in normal servers.)


Would appreciate all help with this issue. Thank you. Let me know if there’s any more context I should add – first time posting in Scripting Support. :slight_smile:

1 Like

You do not need to fire player here because remote events automatically pass the
parameter.

Edit: the reason why the error doesn’t appear in servers is because you are looking at Client logs. There are two buttons near the top-right of dev console that say Client and Server, and because your error is occuring on the server, it wull only appear there. Studio will show both errors for server and client.

1 Like

Thanks for the quick response.


Logs are completely empty both in client and server in-game, which is odd. The error only appears in local servers.

Concerning the remote events, I honestly don’t really know how I would go about excluding the player parameter. I need information on who clicked the buttons in order to reference them in the purchase prompts.

The remote passes the player parameter automatically

Here is what I mean:

remote:FireServer(player, number) -- passes player, player, number

The player parameter gets passed automatically and by you, making there a total of 3 parameters.

1 Like

Thanks for explaining this. This makes a lot more sense, but just a question. In my server script:

PromptPurchaseEvent.OnServerEvent:Connect(function(player, id)
	MarketplaceService:PromptPurchase(player, id)
end)

What would you recommend doing here to acquire the player? I would need to reference it somehow so that it can prompt them with the purchase.

Oh, i meant don’t pass it on the client. It should remain on the server, just you will have one more parameter on the server compared to the client.

1 Like

Aw man. It was that easy? LOL.

Thanks for fixing this issue. I’ve been pondering over this for hours! :slight_smile: