Subtyping error with HTTP streaming_strategy in 0.8.3

Hello!

I’m working on building a storage bucket canister for my project.

I took out the relevant part of my project into a separate github here
You can call test_storage.sh to run the test
The key functions I’m looking at are at the bottom of buckets.mo:
streamingCallback and http_request

I implemented http_request in the buckets.mo with a streaming callback to stream large files.
The first body is sent fine, but when it hits the callback to get the next chunk, the chunk is not sent, I get a typing error from the dfx logs:

opt table5 <: opt variant {
Callback : record {
token : record {
key : text;
sha256 : opt vec nat8;
index : nat;
content_encoding : text;
};
callback : func () → ();
};
} via special opt rule

Which I found out is saying that the type t1 is not a subtype of t2. t1 in this case being whatever ‘opt table 5’ is
I did not have this issue when I was running dfx version 0.8.1, and on that version I’m able to download multiple chunks with no issue. If that’s helpful.

Has anyone has any luck with http streaming, or could point me to what the error can be, or point me in the right direction? Feel free to clone the test repo, and try running it yourself

1 Like