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

Upgrade Partykit and Require a Body for POSTs #2

Merged
merged 3 commits into from
Oct 16, 2023

Conversation

luke-rucker
Copy link
Contributor

Upgraded Partykit deps to their latest versions and made a body required for POST endpoints.

ctx: ExecutionContext,
userCtx: UserContext,
) => UserDefinedResponse | Promise<UserDefinedResponse>;
) => Response | Promise<Response>;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite a few versions ago it seems Partykit now only supports returning Fetch API Responses from onFetch, removing the need for UserDefinedResponse .

@ayoubqrt
Copy link
Contributor

ayoubqrt commented Oct 15, 2023

Hi @luke-rucker ,
EDIT: I didn't saw that you branch is based on a draft PR of alex, so the message is destinated for him.
@astahmer I tried to debug but I think I don't have the appropriate setup to debug this. I build the library to use it in the examples/basic app but voilà I can't debug the library.

Thank you for your work, I tried the example with your version of the library. It's seems that the post request made (Add to counter) don't work. Here's the reason:
image

I didn't investigate more but in the createAssert method i have this values on the objects when I received the post request. The body is still a ReadableStream, it surely have to be parsed before, no ? And the server return status 200 while there is an error.
image

On the create-party-rpc.ts, we can see that alex decode the body before making the safeParse with valibot
image

@astahmer astahmer merged commit 9becf30 into astahmer:feat/fetch-rpc Oct 16, 2023
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

Successfully merging this pull request may close these issues.

None yet

3 participants