-
Notifications
You must be signed in to change notification settings - Fork 95
ci: add extra log to debug failure on CI #912
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -51,6 +51,8 @@ SuperTokensNode.init({ | |||||||||||||||||||||||||||||||||||||||||||||||
| recipeList: [EmailVerification.init({ mode: "OPTIONAL" }), EmailPassword.init(), Session.init()], | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| const TEST_APPLICATION_SERVER_BASE_URL = "http://example.com:3001"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| describe("SuperTokens Example Basic tests", function () { | ||||||||||||||||||||||||||||||||||||||||||||||||
| let browser; | ||||||||||||||||||||||||||||||||||||||||||||||||
| let page; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -67,6 +69,76 @@ describe("SuperTokens Example Basic tests", function () { | |||||||||||||||||||||||||||||||||||||||||||||||
| headless: true, | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
| page = await browser.newPage(); | ||||||||||||||||||||||||||||||||||||||||||||||||
| page.on("console", (msg) => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| if (msg.text().startsWith("com.supertokens")) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| console.log(msg.text()); | ||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| console.log( | ||||||||||||||||||||||||||||||||||||||||||||||||
| `browserlog.console ${JSON.stringify({ | ||||||||||||||||||||||||||||||||||||||||||||||||
| t: new Date().toISOString(), | ||||||||||||||||||||||||||||||||||||||||||||||||
| message: msg.text(), | ||||||||||||||||||||||||||||||||||||||||||||||||
| pageurl: page.url(), | ||||||||||||||||||||||||||||||||||||||||||||||||
| })}` | ||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| page.on("request", (req) => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| console.log( | ||||||||||||||||||||||||||||||||||||||||||||||||
| `browserlog.network ${JSON.stringify({ | ||||||||||||||||||||||||||||||||||||||||||||||||
| t: new Date().toISOString(), | ||||||||||||||||||||||||||||||||||||||||||||||||
| message: `Requested: ${req.method()} ${req.url()} (${req.postData()})`, | ||||||||||||||||||||||||||||||||||||||||||||||||
| pageurl: page.url(), | ||||||||||||||||||||||||||||||||||||||||||||||||
| })}` | ||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
| page.on("requestfinished", async (req) => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| if (req.method() === "OPTION") { | ||||||||||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
| const resp = await req.response(); | ||||||||||||||||||||||||||||||||||||||||||||||||
| let respText; | ||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||
| respText = req.url().startsWith(TEST_APPLICATION_SERVER_BASE_URL) | ||||||||||||||||||||||||||||||||||||||||||||||||
| ? await resp.text() | ||||||||||||||||||||||||||||||||||||||||||||||||
| : "response omitted"; | ||||||||||||||||||||||||||||||||||||||||||||||||
| } catch (e) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| respText = "response loading failed " + e.message; | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
| console.log( | ||||||||||||||||||||||||||||||||||||||||||||||||
| `browserlog.network ${JSON.stringify({ | ||||||||||||||||||||||||||||||||||||||||||||||||
| t: new Date().toISOString(), | ||||||||||||||||||||||||||||||||||||||||||||||||
| message: `Request done: ${req.method()} ${req.url()}: ${resp.status()} ${respText}`, | ||||||||||||||||||||||||||||||||||||||||||||||||
| pageurl: page.url(), | ||||||||||||||||||||||||||||||||||||||||||||||||
| })}` | ||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
| page.on("requestfailed", async (req) => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| if (req.method() === "OPTION") { | ||||||||||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
| const resp = await req.response(); | ||||||||||||||||||||||||||||||||||||||||||||||||
| let respText; | ||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||
| respText = req.url().startsWith(TEST_APPLICATION_SERVER_BASE_URL) | ||||||||||||||||||||||||||||||||||||||||||||||||
| ? await resp.text() | ||||||||||||||||||||||||||||||||||||||||||||||||
| : "response omitted"; | ||||||||||||||||||||||||||||||||||||||||||||||||
| } catch (e) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| respText = "response loading failed " + e.message; | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+120
to
+128
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When handling failed requests, const resp = await req.response();
let respText;
if (!resp) {
respText = 'No response available';
} else {
try {
respText = req.url().startsWith(TEST_APPLICATION_SERVER_BASE_URL)
? await resp.text()
: "response omitted";
} catch (e) {
respText = "response loading failed " + e.message;
}
}This will prevent potential runtime errors when processing failed requests.
Suggested change
Spotted by Diamond |
||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||
| console.log( | ||||||||||||||||||||||||||||||||||||||||||||||||
| `browserlog.network ${JSON.stringify({ | ||||||||||||||||||||||||||||||||||||||||||||||||
| t: new Date().toISOString(), | ||||||||||||||||||||||||||||||||||||||||||||||||
| message: `Request failed: ${req.method()} ${req.url()}: ${resp.status()} ${respText}`, | ||||||||||||||||||||||||||||||||||||||||||||||||
| pageurl: page.url(), | ||||||||||||||||||||||||||||||||||||||||||||||||
| })}` | ||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| } catch (e) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| console.log(e); | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
| return page; | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| after(async function () { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The HTTP method should be
OPTIONS(with an 'S' at the end) rather thanOPTION. This typo will prevent the condition from matching actual OPTIONS requests, causing them to be processed when they should be skipped.Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.