File tree 3 files changed +24
-3
lines changed
3 files changed +24
-3
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @taskless/loader " : patch
3
+ ---
4
+
5
+ Fixes the bypass logic for remote Wasm modules
Original file line number Diff line number Diff line change @@ -31,12 +31,16 @@ export const createHandler = ({
31
31
getModules : ( ) => Promise < Map < string , Promise < Plugin > > > ;
32
32
} ) =>
33
33
http . all ( "https://*" , async ( info ) => {
34
+ // let a bypassed request through to any other handlers
35
+ if ( isBypassed ( info . request ) ) {
36
+ return undefined ;
37
+ }
38
+
34
39
// wait for loaded to unblock (means the shim library has loaded)
35
40
// !ok means disable the library's functionality
36
41
const ok = await loaded ;
37
42
38
- // let a bypassed request through to any other handlers
39
- if ( ! ok || isBypassed ( info . request ) ) {
43
+ if ( ! ok ) {
40
44
return undefined ;
41
45
}
42
46
Original file line number Diff line number Diff line change @@ -215,6 +215,10 @@ export const taskless = (
215
215
params : {
216
216
version : "v1" ,
217
217
} ,
218
+ headers : {
219
+ authorization : `Bearer ${ secret } ` ,
220
+ ...bypass ,
221
+ } ,
218
222
} ) ;
219
223
} catch { }
220
224
}
@@ -257,6 +261,7 @@ export const taskless = (
257
261
headers : {
258
262
authorization : `Bearer ${ secret } ` ,
259
263
"Content-Type" : "application/json" ,
264
+ ...bypass ,
260
265
} ,
261
266
body : JSON . stringify ( networkPayload ) ,
262
267
} ,
@@ -318,6 +323,7 @@ export const taskless = (
318
323
const response = await client [ "/{version}/config" ] . get ( {
319
324
headers : {
320
325
authorization : `Bearer ${ secret } ` ,
326
+ ...bypass ,
321
327
} ,
322
328
params : {
323
329
version : "pre1" ,
@@ -368,7 +374,13 @@ export const taskless = (
368
374
moduleSource . set (
369
375
ident ,
370
376
( async ( ) => {
371
- const data = await fetch ( pack . url . source ) ;
377
+ logger . trace ( `Fetching ${ ident } from ${ pack . url . source } ` ) ;
378
+ const data = await fetch ( pack . url . source , {
379
+ headers : {
380
+ ...bypass ,
381
+ } ,
382
+ } ) ;
383
+ logger . trace ( `Fetched ${ ident } from ${ pack . url . source } ` ) ;
372
384
return data . arrayBuffer ( ) ;
373
385
} ) ( )
374
386
) ;
You can’t perform that action at this time.
0 commit comments