-
Notifications
You must be signed in to change notification settings - Fork 103
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
fetchProfile() doesn't work on +page.server.ts ?? #220
Comments
I've also run into this from time to time too. I've not had a chance to dig into it yet but wanted to at least say that I believe this is reproducible. |
are you sure you are connected on the server side? keep in mind those are two separate connections; worth checking what's on ndk.pool.connectedRelays (iirc) on the server side, you might be missing an |
I'm having this issue also quite a lot (I'm not using svelte components, but just the NDK package). With Alby as a signer the code just stops and does not throw any errors on the console (application and extension). The issue I also mentioned on Nostr earlier where I tagged @pablof7z |
hmm, that makes me wonder if the block is the signer asynchronously waiting for the user to approve. We might not notice it often because we've told our signers to just remember our choice and not ask again... |
@Sebastix I think your issue is different (related?) from mine. What I'm reporting is specifically when calling fetchProfile() from server side code.
Yes. Does look like NDK is connected on server side. But still the code hangs up. I've resorted (for now) to pull kind0 profile events from api.nostr.wine using fetch() on server side. This works. |
@manimejia It's the same codebase we're using for what I can see which works on both sides (server and client). |
This bug nailed me again ... after months of "other stuff" development, I come back to NDK and forgot that it does not connect from the server. What is the issue here... and how might I work around it? |
do you have the websockets polyfill? |
Thanks Pablo. That did work. To use this on Node.js you first must install import { useWebSocketImplementation } from 'nostr-tools/pool'
// or import { useWebSocketImplementation } from 'nostr-tools/relay' if you're using the Relay directly
import WebSocket from 'ws'
useWebSocketImplementation(WebSocket) |
I have client code that works in the browser, and other client code that doesn't work (get stuck while Any other thing to try? Edit: Fixed. Just in case somebody hits the same problem, you have to first call |
I'm really not sure what's going on... but svelte page loading is non responsive with no errors. I've isolated the problem to ndkuser.fetchProfile() being called and everything just stops.
All I'm trying to do is load on server side an ndkuser and profile from Nip05 in URL. My same code block pasted into onMount() on the +page.svelte works. (Not loaded server side) But when pasted into PageLoad() in +page.ts (or PageServerLoad in +page.server.ts) it fails at fetchProfile().
The text was updated successfully, but these errors were encountered: