Skip to content
New issue

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

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

Already on GitHub? # to your account

pub.on で TypeError #11

Open
koteitan opened this issue Sep 17, 2024 · 1 comment
Open

pub.on で TypeError #11

koteitan opened this issue Sep 17, 2024 · 1 comment

Comments

@koteitan
Copy link

node 1-3_post_text.js testo-
{
  pubkey: '722d1ea67f3b9850ea2c8f77e30aacebd850836ea780273614e911c6398b0efc',
  kind: 1,
  content: 'testo-',
  tags: [],
  created_at: 1726597020,
  id: 'c6d6fb0a2a9e6cb86156d2bc3e885a8763a1b396245c5b26d3ba4f38344a1640',
  sig: 'b00d2d82e334934f3f90a7943768a9d1a74829a7f0dd80b71bea2cf4a993e9100a4c8d2203dd1172b670deffdf53fee575b3ddf6942ce095c850d5b3d6b718c0'
}
TypeError: pub.on is not a function
    at main (/home/koteitan/nostr/my-enshu/1-3_post_text.js:52:7)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Promise が帰ってきてて .on がないて言われてます。結果、エラーのときにエラーメッセージが見れません

npm list
learn-nostr-by-crafting@0.1.0 /home/koteitan/nostr/my-enshu
├── nostr-tools@1.17.0
└── websocket-polyfill@0.0.3

try-catch でハンドリングすればいいでしょうか

@koteitan
Copy link
Author

koteitan commented Sep 17, 2024

try{
relay.publish(post);
}catch (e){
console.log(e);
}
で拾えませんでした...

https://github.com/nbd-wtf/nostr-tools/blob/v1.17.0/relay.ts#L348

https://github.com/nbd-wtf/nostr-tools/blob/v1.17.0/relay.ts#L222
に console.log あるから relay.publish(post); で main() 終わりでいいですか

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant