Skip to content

getPlatformProxy "persist" docs are missleading #22007

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

Closed
clibequilibrium opened this issue Apr 27, 2025 · 4 comments · Fixed by #22008
Closed

getPlatformProxy "persist" docs are missleading #22007

clibequilibrium opened this issue Apr 27, 2025 · 4 comments · Fixed by #22008
Assignees
Labels
bug Something isn't working product:workers Related to Workers product

Comments

@clibequilibrium
Copy link

clibequilibrium commented Apr 27, 2025

Which Cloudflare product(s) does this pertain to?

Wrangler

What versions & operating system are you using?

v3+

Please provide a link to a minimal reproduction

No response

Describe the Bug

Hi, getPlatformProxy , persist option expects a boolean or string. However if the user passes a string path it is not respected. See this line in wrangler https://github.com/cloudflare/workers-sdk/blob/d34ef3d5b0e45470e6c06a7bd24a498f85b98af8/packages/wrangler/src/api/integrations/platform/index.ts#L226

This fails:

platform = await getPlatformProxy({
		persist:  './test-path'
	});

This succeeds:

platform = await getPlatformProxy({
		persist: { path: './test-path' }
	});

Either docs need to be edited or wrangler has to be fixed to respect the string parameter.

https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy

@clibequilibrium clibequilibrium added the bug Something isn't working label Apr 27, 2025
@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Apr 27, 2025
@dario-piotrowicz
Copy link
Member

Hi @clibequilibrium 🙂 👋

Thanks for the issue 🙂

Could you please clarify what part of the docs you find incorrect and what you find incorrect about it?

I'm confused because when I navigate to https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy this is what I see for the persist option:
Image

The docs do seem to say that persist is either a boolean or an object of the shape { path: string } (and not a boolean or string)

am I missing something here? 🤔

@clibequilibrium
Copy link
Author

clibequilibrium commented Apr 28, 2025

Hi @clibequilibrium 🙂 👋

Thanks for the issue 🙂

Could you please clarify what part of the docs you find incorrect and what you find incorrect about it?

I'm confused because when I navigate to https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy this is what I see for the persist option: Image

The docs do seem to say that persist is either a boolean or an object of the shape { path: string } (and not a boolean or string)

am I missing something here? 🤔

Hi, thank you!

Yes the part that is wrong is:

Image

The persist flag actually expects an object not a string. So specifying the path like so:

persist:  './path'

will not work. Only

	persist: { path: './path' }

will work. See this line https://github.com/cloudflare/workers-sdk/blob/d34ef3d5b0e45470e6c06a7bd24a498f85b98af8/packages/wrangler/src/api/integrations/platform/index.ts#L226

If the user just passes the string, wrangler will not consume it as it expects an object with the variable path in it.

@dario-piotrowicz dario-piotrowicz transferred this issue from cloudflare/workers-sdk Apr 28, 2025
@github-actions github-actions bot added the product:workers Related to Workers product label Apr 28, 2025
@dario-piotrowicz
Copy link
Member

dario-piotrowicz commented Apr 28, 2025

Thank you for the clarification @clibequilibrium 🙂

Yes you're right, I didn't notice that bit, that's indeed a small mistake in the getPlatformProxy docs, I've transferred the issue to the docs repo 🙂

@dario-piotrowicz
Copy link
Member

dario-piotrowicz commented Apr 29, 2025

The issue should have been fixed now @clibequilibrium 😄, if you want please take a look and let me know if you still spot anything wrong 🙂 thanks again for reporting the issue 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working product:workers Related to Workers product
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants