Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: POST to submitMessage times out even though message is created #2239

Open
kengoldfarb opened this issue Aug 5, 2024 · 2 comments
Open
Labels
s-triage Needs to be reviewed, designed and prioritized

Comments

@kengoldfarb
Copy link
Contributor

What is the bug?
When using the HTTP hubble API to submit a message via the /v1/submitMessage endpoint the request never responds / times out. The message itself is accepted and shows up when requesting the user's casts via the /v1/castsByFid endpoint.

Maybe some relevant context?
My app is getting permission to post on the user's behalf by creating a signature and adding it to the KeyRegistry by interacting directly with the contracts (not going through warpcast api).

I've reproduced this against my own hub (v1.14.2) as well as nemes.farcaster.xyz both inside my app and outside it by constructing the request in Postman.

Example code

export const sendCast = async (options: {
	text: string
	signer: NobleEd25519Signer
	fid: number
	parentUrl?: string
	replyToHash?: string
}) => {
	const { text, replyToHash, parentUrl, signer, fid } = options

	const msg = await makeCastAdd(
		{
			parentUrl,
			parentCastId: replyToHash
				? CastId.create({ hash: replyToHash })
				: undefined,
			text,
			embeds: [],
			embedsDeprecated: [],
			mentions: [],
			mentionsPositions: []
		},
		{
			fid,
			network: FarcasterNetwork.MAINNET
		},
		signer
	)

	const messageBytes = Buffer.from(Message.encode(msg._unsafeUnwrap()).finish())

	// This times out but the message is added
	await axios.post(`${Config.HUB_URL}/v1/submitMessage`, messageBytes, {
		headers: {
			'Content-Type': 'application/octet-stream'
		},
		timeout: 10000
	})
}
@github-actions github-actions bot added the s-triage Needs to be reviewed, designed and prioritized label Aug 5, 2024
@randombishop
Copy link

Observed the same with my own hub. Could be a coincidence but I noticed that it generally occurs when Merkle Trie Queue Size shows higher values in the grafana dashboard.

@Rufusemmanuel
Copy link

It sounds like you're encountering a timeout issue when submitting a message through the Hubble API, even though the message is successfully created and retrievable. You can try out this few steps to troubleshoot and potentially resolve the issue:

Check API Documentation: Ensure that you are adhering to the expected request format and parameters for the /v1/submitMessage endpoint. Look for any specific requirements that might cause the request to hang.
Inspect Network Traffic: Use a tool like Postman or browser dev tools to inspect the network traffic. Check for:
Request headers and body to ensure they're formatted correctly.
Any error responses or logs from the server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s-triage Needs to be reviewed, designed and prioritized
Projects
None yet
Development

No branches or pull requests

3 participants