ERROR : “Not enough relays received the event”

I give up. Wasted days trying to get to the bottom of this. Still stuck.

Any clues?

Sats for Help!

#ndk #dev #nostrdev

nostr:npub1zuuajd7u3sx8xu92yav9jwxpr839cs0kc3q6t56vd5u9q033xmhsk6c2uc nostr:npub1l2vyh47mk2p0qlsku7hg0vn29faehy9hy34ygaclpn66ukqp3afqutajft

https://github.com/nostr-dev-kit/ndk/blob/a2bb4783f16df0a8076b0c4086007bbafc9126d5/ndk/src/relay/sets/index.ts#L167

Reply to this note

Please Login to reply.

Discussion

Confirmed :

- successful relay req

- 6 active relays in write list

- properly formatted event

- internet connected

Result :

- no response from relays

- or missing “ok” in response

Are you setting created at properly? In seconds and in the current time? Relays may not accept notes in the past or in the future

Set created_at with new NDKEvent, in same function and immediately before calling event.publish()

But … not in seconds 🤦🏻‍♂️

Let me check on that …

Yea. created_at in seconds … still no fix.

You need to put a delay on the subscription after connecting.

I’m not “subscribing” … don’t have a REQ open. Only fetched existing events of kind 30000 (follow lists) and then (after user actions) publishing a new one.

I am using NDK.connect() to trigger browser extension “login” … but this is well before user “publish” action.

Gzuuus … you were right all along. My timestamp was not formatted properly.

BUUUT in my defense, NDK event.publish() doesn’t report errors from relays … and relays also don’t report useful errors when fail to write.

Had to deconstruct NDK to even get a stupid error logged like this (as returned from my relays) :

“wrong index for variant”

Nostr sucks for debugging.

Yes, I know I was fighting with this, and other stuff transmitted by relays xD I would like to have validation in ndk of some fields like this one that may break the nostr

Event.publish() does report if an event wasn’t published to the mimnimum requires number of relays; it throws a RelayError or something like that with all the errors the relays returned

Leaving an action item for myself here: #ndk add error handling to the guides documentation

Thank you Pablo. FWIW… I had to use relay.publish() to get the actual OK `message` (4th element in array) sent by rely (regardless of `accepted` 3rd element), because event.publish() only returns a list of relays who send OK with `accepted` == `true`.