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

fetchProfile() doesn't work on +page.server.ts ?? #220

Open
manimejia opened this issue May 7, 2024 · 6 comments
Open

fetchProfile() doesn't work on +page.server.ts ?? #220

manimejia opened this issue May 7, 2024 · 6 comments

Comments

@manimejia
Copy link

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().

@erskingardner
Copy link
Collaborator

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.

@pablof7z
Copy link
Collaborator

pablof7z commented May 9, 2024

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 ndk.connect() on the server.

@Sebastix
Copy link
Contributor

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).
With the extension nos2x is succeeds around 90% of the time, but the same 'bug' pops up from time to time.

The issue I also mentioned on Nostr earlier where I tagged @pablof7z
https://nostrudel.ninja/#/n/nevent1qvzqqqqqqypzqpnrnguxe8qszsshvgkvhn6qjzxy7xsvx03rlrtddr62haj4lrm3qy88wumn8ghj7mn0wvhxcmmv9uq36amnwvaz7tmwdaehgu3wd46hg6tw09mkzmrvv46zucm0d5hsqg9s32gxctx2u5u4cp3yzqdnsx72lyy7j6vwcyngrfj6n2em7ns28vqpcrs8

@erskingardner
Copy link
Collaborator

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...

@manimejia
Copy link
Author

@Sebastix I think your issue is different (related?) from mine. What I'm reporting is specifically when calling fetchProfile() from server side code.

@pablof7z :

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 ndk.connect() on the server.

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.

@Sebastix
Copy link
Contributor

@manimejia It's the same codebase we're using for what I can see which works on both sides (server and client).

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

No branches or pull requests

4 participants