workers-rs icon indicating copy to clipboard operation
workers-rs copied to clipboard

[BUG] http feature is not additive

Open crestonbunch opened this issue 1 year ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

What version of workers-rs are you using?

0.0.21

What version of wrangler are you using?

3.37.0

Describe the bug

The http feature is not additive, which is necessary for feature unification to work. This prevents, e.g. multiple workers in the same workspace from using different feature sets.

Steps To Reproduce

  1. Create a Cargo workspace with two workers
  2. In one worker, use the http feature
  3. In another worker, do not use the http feature.
  4. Observe that the non-http worker cannot compile.

crestonbunch avatar Mar 24 '24 15:03 crestonbunch

I'm not sure if this will be possible, there are a few APIs that we are wanting to change in place which prevents a purely additive feature. I did run into this issue with the axum example.

kflansburg avatar Mar 24 '24 16:03 kflansburg

@crestonbunch It was not supposed to work that way, but you can use the axum-cloudflare-adapter

https://github.com/logankeenan/axum-cloudflare-adapter

There you have instructions on how to do it.

That's why we are maintaining the adapter.

But pretty much, you don't enable the http feature till you are done migration, instead you use the adapter.

If you have issues, they are likely also present on workers-rs with http enabled.

Anyway you can find people on discord on #rust-on-workers that have or are going through that migration.

spigaz avatar Mar 24 '24 16:03 spigaz