Skip to content

[BUG] Relay is not accepting Text Events #284

@sroertgen

Description

@sroertgen

Describe the bug
With the current version (commit fb6948f) nostream is not accepting events. Sending a simple event with nostr-tools gives no response. Requesting events works as expected though.

Switching to commit f237400 solves the issue. Everything works as expected.

To Reproduce
Steps to reproduce the behavior:

  1. Run command:
  • Start nostream witch mentioned commit checked out
  • execute sth like:
import 'websocket-polyfill'
import {
 relayInit,
 getPublicKey,
 getEventHash,
 signEvent
} from 'nostr-tools'

const relay = relayInit('wss://example.com')
let privateKey = 'xxx'


relay.on('connect', () => {
 console.log(`connected to ${relay.url}`)
})
relay.on('error', () => {
 console.log(`failed to connect to ${relay.url}`)
})

await relay.connect()

let event = {
 kind: 1,
 created_at: Math.floor(Date.now() / 1000),
 tags: [],
 content: 'Hello world! This is a test',
 pubkey: getPublicKey(privateKey)
}

event.id = getEventHash(event)
event.sig = signEvent(event, privateKey)

let pub = relay.publish(event)
pub.on('ok', () => {
 console.log(`${relay.url} has accepted our event`)
})
pub.on('failed', reason => {
 console.log(`failed to publish to ${relay.url}: ${reason}`)
})
  1. See error: Event is not accepted, but no error is thrown either.

Expected behavior
The event got accepted

System (please complete the following information):

  • OS: Ubuntu 22.04
  • Platform: docker
  • Version: commit fb6948f

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingreleased

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions