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] Relay is not accepting Text Events #284

Closed
sroertgen opened this issue Apr 14, 2023 · 2 comments · Fixed by #298
Closed

[BUG] Relay is not accepting Text Events #284

sroertgen opened this issue Apr 14, 2023 · 2 comments · Fixed by #298
Assignees
Labels
bug Something isn't working released

Comments

@sroertgen
Copy link
Contributor

sroertgen commented Apr 14, 2023

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
@sroertgen sroertgen added the bug Something isn't working label Apr 14, 2023
@sroertgen
Copy link
Contributor Author

The error seemed to stem from a missing environment variable SECRET, which is by now mandatory.

After adding that everything works as expected.

sroertgen added a commit to sroertgen/nostream that referenced this issue May 5, 2023
@github-actions
Copy link

🎉 This issue has been resolved in version 1.23.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants