-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/config fixes #61
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
bf47ffe
ff14ee4
a5a6205
7a1d2fb
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 | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,6 +7,8 @@ app.use(express.json()); | |||||||||||||||||
|
|
||||||||||||||||||
| app.post("/hooks/catch/:userId/:workflowId", async (req, res) => { | ||||||||||||||||||
| try { | ||||||||||||||||||
|
|
||||||||||||||||||
| console.log("THIS LOG IS FROM HOOKS BACKEND THAT WE HAVE RECIEVED THE REQUEST") | ||||||||||||||||||
| const { userId, workflowId } = req.params; | ||||||||||||||||||
|
Comment on lines
+10
to
12
|
||||||||||||||||||
| const { triggerData } = req.body; | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
@@ -24,7 +26,7 @@ app.post("/hooks/catch/:userId/:workflowId", async (req, res) => { | |||||||||||||||||
| const workflowExecution = await tx.workflowExecution.create({ | ||||||||||||||||||
| data: { | ||||||||||||||||||
| workflowId: workflow.id, | ||||||||||||||||||
| // next time you see this line validate the trigger data thinnnnnnnnnn | ||||||||||||||||||
| // next time you see this line validate the trigger data thinnnnnnnnnn | ||||||||||||||||||
| status: "Pending", | ||||||||||||||||||
| metadata: triggerData, | ||||||||||||||||||
| }, | ||||||||||||||||||
|
|
@@ -39,13 +41,13 @@ app.post("/hooks/catch/:userId/:workflowId", async (req, res) => { | |||||||||||||||||
| }); | ||||||||||||||||||
| return res.status(200).json({ | ||||||||||||||||||
| success: true, | ||||||||||||||||||
| workflowExecutionId: result.workflowExecution.id, | ||||||||||||||||||
| workflowExecutionId: result.workflowExecution.id, | ||||||||||||||||||
| }); | ||||||||||||||||||
| } catch (error: any) { | ||||||||||||||||||
| console.log(error); | ||||||||||||||||||
| res.status(500).json({ | ||||||||||||||||||
| success: false, | ||||||||||||||||||
| error: "Failed to process webhook" | ||||||||||||||||||
| res.status(500).json({ | ||||||||||||||||||
| success: false, | ||||||||||||||||||
| error: "Failed to process webhook" | ||||||||||||||||||
| }); | ||||||||||||||||||
|
Comment on lines
+48
to
51
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. Missing Without a 🐛 Suggested fix console.log(error);
- res.status(500).json({
+ return res.status(500).json({
success: false,
error: "Failed to process webhook"
});📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||
| } | ||||||||||||||||||
| }); | ||||||||||||||||||
|
|
||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -72,6 +72,7 @@ googleAuth.get( | |||||||||||
| "/callback", | ||||||||||||
| userMiddleware, | ||||||||||||
| async (req: Request, res: Response) => { | ||||||||||||
| console.log("Request recieved to the callback from fronted ") | ||||||||||||
|
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. Fix typos in log message. The log message contains spelling errors: "recieved" → "received" and "fronted" → "frontend". 📝 Suggested fix- console.log("Request recieved to the callback from fronted ")
+ console.log("Request received to the callback from frontend")📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||
| console.log("Request recieved to the callback from fronted ") |
Copilot
AI
Jan 27, 2026
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.
Avoid automated semicolon insertion (94% of all statements in the enclosing function have an explicit semicolon).
| console.log("Request recieved to the callback from fronted ") | |
| console.log("Request recieved to the callback from fronted "); |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -13,8 +13,11 @@ import { | |||||||||||||||||||||||||||||||||
| NodeUpdateSchema, | ||||||||||||||||||||||||||||||||||
| TriggerUpdateSchema, | ||||||||||||||||||||||||||||||||||
| workflowUpdateSchema, | ||||||||||||||||||||||||||||||||||
| ExecuteWorkflow, | ||||||||||||||||||||||||||||||||||
| HOOKS_URL, | ||||||||||||||||||||||||||||||||||
| } from "@repo/common/zod"; | ||||||||||||||||||||||||||||||||||
| import { GoogleSheetsNodeExecutor } from "@repo/nodes"; | ||||||||||||||||||||||||||||||||||
| import axios, { Axios } from "axios"; | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
| import axios, { Axios } from "axios"; | |
| import axios from "axios"; |
Copilot
AI
Jan 27, 2026
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.
Avoid automated semicolon insertion (90% of all statements in the enclosing function have an explicit semicolon).
| console.log("The type of data comming to backed is ", type) | |
| console.log("The type of data comming to backed is ", type); |
Copilot
AI
Jan 27, 2026
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.
/getCredentials/:type returns only { message } when no credentials exist, but returns { data, hasCredentials } when they do. This inconsistent response shape breaks clients that always read response.data.data. Return a consistent shape (e.g., data: [] and hasCredentials: false) for the empty case too.
| message: "No credentials found", | |
| message: "No credentials found", | |
| data: [], | |
| hasCredentials: false, |
Copilot
AI
Jan 27, 2026
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.
Avoid automated semicolon insertion (90% of all statements in the enclosing function have an explicit semicolon).
| console.log("This is from the backend log of positions", dataSafe.data.position) | |
| console.log("This is from the backend log of positions", dataSafe.data.position); |
Copilot
AI
Jan 27, 2026
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.
This route-level log is noisy and not actionable in production. Prefer the app logger with a debug level, or remove it once the feature is verified.
Copilot
AI
Jan 27, 2026
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.
Validation failures from ExecuteWorkflow.safeParse should return 400 (BAD_REQUEST), not 403 (FORBIDDEN). Also consider returning the Zod error under a consistent error key (not Data) and fix the typo in the message ("Schema").
| return res.status(statusCodes.FORBIDDEN).json({ | |
| message: "Error in Zod Schma", | |
| Data: parsedData.error | |
| return res.status(statusCodes.BAD_REQUEST).json({ | |
| message: "Error in Zod Schema", | |
| error: parsedData.error |
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.
Use BAD_REQUEST (400) instead of FORBIDDEN (403) for validation errors.
HTTP 403 Forbidden indicates authorization issues, not input validation failures. Zod schema validation errors should return 400 Bad Request.
Proposed fix
if (!parsedData.success) {
- return res.status(statusCodes.FORBIDDEN).json({
- message: "Error in Zod Schma",
+ return res.status(statusCodes.BAD_REQUEST).json({
+ message: "Invalid input",
Data: parsedData.error
})
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const parsedData = ExecuteWorkflow.safeParse(Data); | |
| console.log("This is the log data of execute work flow zod", parsedData.error) | |
| if (!parsedData.success) { | |
| return res.status(statusCodes.FORBIDDEN).json({ | |
| message: "Error in Zod Schma", | |
| Data: parsedData.error | |
| }) | |
| } | |
| const parsedData = ExecuteWorkflow.safeParse(Data); | |
| console.log("This is the log data of execute work flow zod", parsedData.error) | |
| if (!parsedData.success) { | |
| return res.status(statusCodes.BAD_REQUEST).json({ | |
| message: "Invalid input", | |
| Data: parsedData.error | |
| }) | |
| } |
🤖 Prompt for AI Agents
In `@apps/http-backend/src/routes/userRoutes/userRoutes.ts` around lines 643 -
650, The route currently treats Zod validation failures from
ExecuteWorkflow.safeParse as a 403; change the response to use
statusCodes.BAD_REQUEST (400) instead of statusCodes.FORBIDDEN and return the
parsedData.error payload. Locate the block using ExecuteWorkflow.safeParse,
parsedData, and the res.status(...).json call and replace statusCodes.FORBIDDEN
with statusCodes.BAD_REQUEST and ensure the error message/field
(parsedData.error) is returned as before.
Copilot
AI
Jan 27, 2026
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.
Avoid logging full workflow/trigger objects during execution (trigger can include user/workflow metadata). Use structured logging with redaction and/or log only identifiers at debug level.
| console.log("This is the Trigger Data of the workflow", trigger) | |
| console.log("This is the Trigger metadata of the workflow", { | |
| workflowId: trigger.id, | |
| triggerId: trigger.Trigger?.id, | |
| triggerName: trigger.Trigger?.name, | |
| }); |
Copilot
AI
Jan 27, 2026
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.
Avoid automated semicolon insertion (90% of all statements in the enclosing script have an explicit semicolon).
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -18,7 +18,8 @@ export const useCredentials = (type: string, workflowId?: string): any => { | |||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| const response = await getCredentials(type); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| const data = JSON.stringify(response) | ||||||||||||||||||||||
| console.log("This is the log from usecredentials" , data) | ||||||||||||||||||||||
|
Comment on lines
+21
to
+22
|
||||||||||||||||||||||
| const data = JSON.stringify(response) | |
| console.log("This is the log from usecredentials" , data) | |
| if (process.env.NODE_ENV !== "production") { | |
| console.log("useCredentials fetched credentials", { | |
| type, | |
| workflowId, | |
| credentialCount: Array.isArray(response) ? response.length : undefined, | |
| }); | |
| } |
Copilot
AI
Jan 27, 2026
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.
After switching node configs to use the credential type google_oauth, this hook still treats Google OAuth as type === "google" (see the authUrl logic later in this hook). As a result, the Google OAuth redirect URL won’t be set for google_oauth. Update the type check(s) to use the new credential type (or standardize the type string across the app).
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,11 +8,11 @@ import { getCredentials } from "../workflow/lib/config"; | |
| export const api = { | ||
| user: { | ||
| get: async () => { | ||
| return await axios.get(`${BACKEND_URL}/user/workflows`, | ||
| return await axios.get(`${BACKEND_URL}/user/workflows`, | ||
| { | ||
| withCredentials: true, | ||
| headers: { "Content-Type": "application/json" }, | ||
| }) | ||
| withCredentials: true, | ||
| headers: { "Content-Type": "application/json" }, | ||
| }) | ||
| } | ||
| }, | ||
| workflows: { | ||
|
|
@@ -38,6 +38,12 @@ export const api = { | |
| withCredentials: true, | ||
| headers: { "Content-Type": "application/json" }, | ||
| }) | ||
| }, | ||
| execute: async (data: any) => { | ||
| return await axios.post(`${BACKEND_URL}/user/executeWorkflow`, data, { | ||
| withCredentials: true, | ||
| headers: { "Content-Type": "application/json" }, | ||
| }) | ||
|
Comment on lines
+42
to
+46
|
||
| } | ||
| }, | ||
| triggers: { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,7 +31,7 @@ export default async function Home() { | |
| ) : ( | ||
| <> | ||
| <p>Status: Not authenticated</p> | ||
| <form action="/api/auth/signin" method="post"> | ||
| <form action="/login" method="post"> | ||
|
||
| <button | ||
| type="submit" | ||
| className="px-4 py-2 mt-4 bg-green-500 text-white rounded" | ||
|
|
||
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.
Fix typo in log message.
"RECIEVED" should be "RECEIVED".
📝 Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents