fix(teams): webhook notifications crash#2426
fix(teams): webhook notifications crash#2426icecrasher321 merged 33 commits intosimstudioai:stagingfrom
Conversation
…ndition, other improvements
…pylon, intercom, mailchimp, loading optimizations (simstudioai#2132) * fix(memory-util): fixed unbounded array of gmail/outlook pollers causing high memory util, added missing db indexes/removed unused ones, auto-disable schedules/webhooks after 10 consecutive failures (simstudioai#2115) * fix(memory-util): fixed unbounded array of gmail/outlook pollers causing high memory util, added missing db indexes/removed unused ones, auto-disable schedules/webhooks after 10 consecutive failures * ack PR comments * ack * improvement(teams-plan): seats increase simplification + not triggering checkout session (simstudioai#2117) * improvement(teams-plan): seats increase simplification + not triggering checkout session * cleanup via helper * feat(tools): added sentry, incidentio, and posthog tools (simstudioai#2116) * feat(tools): added sentry, incidentio, and posthog tools * update docs * fixed docs to use native fumadocs for llms.txt and copy markdown, fixed tool issues * cleanup * enhance error extractor, fixed posthog tools * docs enhancements, cleanup * added more incident io ops, remove zustand/shallow in favor of zustand/react/shallow * fix type errors * remove unnecessary comments * added vllm to docs * feat(i18n): update translations (simstudioai#2120) * feat(i18n): update translations * fix build --------- Co-authored-by: waleedlatif1 <waleedlatif1@users.noreply.github.com> * improvement(workflow-execution): perf improvements to passing workflow state + decrypted env vars (simstudioai#2119) * improvement(execution): load workflow state once instead of 2-3 times * decrypt only in get helper * remove comments * remove comments * feat(models): host google gemini models (simstudioai#2122) * feat(models): host google gemini models * remove unused primary key * feat(i18n): update translations (simstudioai#2123) Co-authored-by: waleedlatif1 <waleedlatif1@users.noreply.github.com> * feat(tools): added zendesk, pylon, intercom, & mailchimp (simstudioai#2126) * feat(tools): added zendesk, pylon, intercom, & mailchimp * finish zendesk and pylon * updated docs * feat(i18n): update translations (simstudioai#2129) * feat(i18n): update translations * fixed build --------- Co-authored-by: waleedlatif1 <waleedlatif1@users.noreply.github.com> * fix(permissions): add client-side permissions validation to prevent unauthorized actions, upgraded custom tool modal (simstudioai#2130) * fix(permissions): add client-side permissions validation to prevent unauthorized actions, upgraded custom tool modal * fix failing test * fix test * cleanup * fix(custom-tools): add composite index on custom tool names & workspace id (simstudioai#2131) --------- Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com> Co-authored-by: waleedlatif1 <waleedlatif1@users.noreply.github.com>
… sendgrid, linkedin, more tools (simstudioai#2148) * feat(tools): added smtp, sendgrid, mailgun, linkedin, fixed permissions in context menu (simstudioai#2133) * feat(tools): added twilio sendgrid integration * feat(tools): added smtp, sendgrid, mailgun, fixed permissions in context menu * added top level mocks for sporadically failing tests * incr type safety * fix(team-plans): track departed member usage so value not lost (simstudioai#2118) * fix(team-plans): track departed member usage so value not lost * reset usage to 0 when they leave team * prep merge with stagig * regen migrations * fix org invite + ws selection' --------- Co-authored-by: Waleed <walif6@gmail.com> * feat(i18n): update translations (simstudioai#2134) Co-authored-by: waleedlatif1 <waleedlatif1@users.noreply.github.com> * feat(creators): add verification for creators (simstudioai#2135) * feat(tools): added apify block/tools (simstudioai#2136) * feat(tools): added apify * cleanup * feat(i18n): update translations (simstudioai#2137) Co-authored-by: waleedlatif1 <waleedlatif1@users.noreply.github.com> * feat(env): added more optional env var examples (simstudioai#2138) * feat(statuspage): added statuspage, updated list of tools in footer, renamed routes (simstudioai#2139) * feat(statuspage): added statuspage, updated list of tools in footer, renamed routes * ack PR comments * feat(tools): add generic search tool (simstudioai#2140) * feat(i18n): update translations (simstudioai#2141) * fix(sdks): bump sdk versions (simstudioai#2142) * fix(webhooks): count test webhooks towards usage limit (simstudioai#2143) * fix(bill): add requestId to webhook processing (simstudioai#2144) * improvement(subflow): remove all associated edges when moving a block into a subflow (simstudioai#2145) * improvement(subflow): remove all associated edges when moving a block into a subflow * ack PR comments * fix(polling): mark webhook failed on webhook trigger errors (simstudioai#2146) * fix(deps): declare core transient deps explicitly (simstudioai#2147) * fix(deps): declare core transient deps explicitly * ack PR comments --------- Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com> Co-authored-by: waleedlatif1 <waleedlatif1@users.noreply.github.com>
…lymarket, datadog, ahrefs, gitlab, shopify, ssh, wordpress integrations
…ding improvements, new slack tools
…opilot improvements
… docs, mcp, autolayout improvements (simstudioai#2286) * fix(mcp): prevent redundant MCP server discovery calls at runtime, use cached tool schema instead (simstudioai#2273) * fix(mcp): prevent redundant MCP server discovery calls at runtime, use cached tool schema instead * added backfill, added loading state for tools in settings > mcp * fix tool inp * feat(rate-limiter): token bucket algorithm (simstudioai#2270) * fix(ratelimit): make deployed chat rate limited * improvement(rate-limiter): use token bucket algo * update docs * fix * fix type * fix db rate limiter * address greptile comments * feat(i18n): update translations (simstudioai#2275) Co-authored-by: icecrasher321 <icecrasher321@users.noreply.github.com> * fix(tools): updated kalshi and polymarket tools to accurately reflect outputs (simstudioai#2274) * feat(i18n): update translations (simstudioai#2276) Co-authored-by: waleedlatif1 <waleedlatif1@users.noreply.github.com> * fix(autolayout): align by handle (simstudioai#2277) * fix(autolayout): align by handle * use shared constants everywhere * cleanup * fix(copilot): fix custom tools (simstudioai#2278) * Fix title custom tool * Checkpoitn (broken) * Fix custom tool flash * Edit workflow returns null fix * Works * Fix lint * fix(ime): prevent form submission during IME composition steps (simstudioai#2279) * fix(ui): prevent form submission during IME composition steps * chore(gitignore): add IntelliJ IDE files to .gitignore --------- Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com> Co-authored-by: Waleed <walif6@gmail.com> Co-authored-by: waleedlatif1 <waleedlatif1@users.noreply.github.com> * feat(ui): logs, kb, emcn (simstudioai#2207) * feat(kb): emcn alignment; sidebar: popover primary; settings-modal: expand * feat: EMCN breadcrumb; improvement(KB): UI * fix: hydration error * improvement(KB): UI * feat: emcn modal sizing, KB tags; refactor: deleted old sidebar * feat(logs): UI * fix: add documents modal name * feat: logs, emcn, cursorrules; refactor: logs * feat: dashboard * feat: notifications; improvement: logs details * fixed random rectangle on canvas * fixed the name of the file to align * fix build --------- Co-authored-by: waleed <walif6@gmail.com> * fix(creds): glitch allowing multiple credentials in an integration (simstudioai#2282) * improvement: custom tools modal, logs-details (simstudioai#2283) * fix(docs): fix copy page button and header hook (simstudioai#2284) * improvement(chat): add the ability to download files from the deployed chat (simstudioai#2280) * added teams download and chat download file * Removed comments * removed comments * component structure and download all * removed comments * cleanup code * fix empty files case * small fix * fix(container): resize heuristic improvement (simstudioai#2285) * estimate block height for resize based on subblocks * fix hydration error * make more conservative --------- Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com> Co-authored-by: icecrasher321 <icecrasher321@users.noreply.github.com> Co-authored-by: waleedlatif1 <waleedlatif1@users.noreply.github.com> Co-authored-by: Siddharth Ganesan <33737564+Sg312@users.noreply.github.com> Co-authored-by: mosa <mosaxiv@gmail.com> Co-authored-by: Emir Karabeg <78010029+emir-karabeg@users.noreply.github.com> Co-authored-by: Adam Gough <77861281+aadamgough@users.noreply.github.com>
…tudioai#2291) * feat(folders): add the ability to create a folder within a folder in popover (simstudioai#2287) * fix(agent): filter out empty params to ensure LLM can set tool params at runtime (simstudioai#2288) * fix(mcp): added backfill effect to add missing descriptions for mcp tools (simstudioai#2290) * fix(redis): cleanup access pattern across callsites (simstudioai#2289) * fix(redis): cleanup access pattern across callsites * swap redis command to be non blocking * improvement(log-details): polling, trace spans (simstudioai#2292) --------- Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com> Co-authored-by: Emir Karabeg <78010029+emir-karabeg@users.noreply.github.com>
|
@CodeLoopdroid is attempting to deploy a commit to the Sim Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryAdded defensive null check for empty Key changes:
Notes:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller as formatWebhookInput
participant Guard as Guard Check
participant Fn as formatTeamsGraphNotification
participant Logger as Logger
Caller->>Guard: Check body.value exists & length > 0
alt Array is empty or missing
Guard-->>Caller: Skip function call
else Array has elements
Guard->>Fn: Call with body
Fn->>Fn: Extract notification = body.value?.[0]
alt notification is null/undefined
Fn->>Logger: logger.warn('Received empty Teams notification body')
Fn-->>Caller: return null
else notification exists
Fn->>Fn: Extract changeType, resource, subscriptionId
Fn->>Fn: Parse chatId & messageId from resource
Fn->>Fn: Fetch message data from Teams API
Fn-->>Caller: return formatted notification
end
end
|
There was a problem hiding this comment.
Additional Comments (2)
-
apps/sim/lib/webhooks/utils.server.ts, line 121 (link)style: inconsistent with line 84 - should use
notification.resourceDatainstead ofbody.value[0].resourceDatasincenotificationis already extractedNote: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
-
apps/sim/lib/webhooks/utils.server.ts, line 79 (link)style: violates TypeScript style guide - replace
anywith proper types orunknownwith type guardsNote: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Context Used: Context from
dashboard- TypeScript conventions and type safety (source)
1 file reviewed, 2 comments
There was a problem hiding this comment.
@CodeLoopdroid you should be in packages/db not apps/sim?
There was a problem hiding this comment.
Thanks for the review!
Just to clarify, are you suggesting that the Teams webhook parsing logic should be moved into packages/db and then imported into apps/sim, or is the current fix in apps/sim acceptable for now?
There was a problem hiding this comment.
Was referring to you adding the comment in the readme -- for running bunx drizzle-kit migrate you should be inside packages/db
There was a problem hiding this comment.
Thanks for the clarification, @icecrasher321
I’ve updated the README file to reflect the correct working directory for running migrations.
There was a problem hiding this comment.
Hi @waleedlatif1
Could you approve the pending workflow / Vercel auth when you have time?
Thanks
| <Link | ||
| key={block} | ||
| href={`https://docs.sim.ai/blocks/${block.toLowerCase().replace(' ', '-')}`} | ||
| href={`https://docs.sim.ai/blocks/${block.toLowerCase().replaceAll(' ', '-')}`} |
There was a problem hiding this comment.
what is this change fixing?
There was a problem hiding this comment.
@icecrasher321
Well, this change fixes how the link for the "Human In The Loop" block is generated in the documentation. One of the blocks in FOOTER_BLOCKS is Human In The Loop, which has multiple words. The link is built by lowercasing the name and replacing spaces with hyphens, but using replace(' ', '-') only replaces the first space. That turns "Human In The Loop" into human-in the loop, leaving extra spaces that get URL-encoded and cause a 404 because the docs expect human-in-the-loop. Switching to replaceAll(' ', '-') replaces every space, generates the correct slug, and ensures multi word blocks always link to the correct documentation page, including any added in the future.
Being Demonstrated:
@waleedlatif1
Summary
This PR fixes a crash in the formatTeamsGraphNotification function in apps/sim/lib/webhooks/utils.server.ts.
Previously, the function assumed that body.value always contained at least one element. If an empty array was received, the server would throw a TypeError when accessing notification.changeType.
Fixes #2425
Type of Change
Testing
How has this been tested? What should reviewers focus on?
Tested locally using a reproduction script with payloads like:
{ "value": [] }Observed that:
No other functionality was affected.
Checklist