You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"shouldBlockRequest() was called without a context. The request will not be blocked. Make sure to call shouldBlockRequest() within an HTTP request. If you're using serverless functions, make sure to use the handler wrapper provided by Zen. Also ensure you import Zen at the top of your main app file (before any other imports).",
38
+
"Zen.shouldBlockRequest() was called without a context. The request will not be blocked. Make sure to call shouldBlockRequest() within an HTTP request. If you're using serverless functions, make sure to use the handler wrapper provided by Zen. Also ensure you import Zen at the top of your main app file (before any other imports).",
Copy file name to clipboardExpand all lines: library/middleware/shouldBlockRequest.ts
+21-1Lines changed: 21 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,11 @@ export function shouldBlockRequest(): Result {
21
21
return{block: false};
22
22
}
23
23
24
+
if(context.executedMiddleware){
25
+
logWarningAlreadyExecutedMiddleware();
26
+
return{block: false};
27
+
}
28
+
24
29
updateContext(context,"executedMiddleware",true);
25
30
agent.onMiddlewareExecuted();
26
31
@@ -50,8 +55,23 @@ function logWarningShouldBlockRequestCalledWithoutContext() {
50
55
51
56
// eslint-disable-next-line no-console
52
57
console.warn(
53
-
"shouldBlockRequest() was called without a context. The request will not be blocked. Make sure to call shouldBlockRequest() within an HTTP request. If you're using serverless functions, make sure to use the handler wrapper provided by Zen. Also ensure you import Zen at the top of your main app file (before any other imports)."
58
+
"Zen.shouldBlockRequest() was called without a context. The request will not be blocked. Make sure to call shouldBlockRequest() within an HTTP request. If you're using serverless functions, make sure to use the handler wrapper provided by Zen. Also ensure you import Zen at the top of your main app file (before any other imports)."
0 commit comments