Skip to content

Commit b5b12ba

Browse files
CodeLoopdroidicecrasher321waleedlatif1Sg312mosaxiv
authored
fix(teams): webhook notifications crash (#2426)
* fix(docs): clarify working directory for drizzle migration (#2375) * fix(landing): prevent url encoding for spaces for footer links (#2376) * fix: handle empty body.value in Teams webhook notification parser (#2425) * Update directory path for migration command --------- Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com> Co-authored-by: Waleed <walif6@gmail.com> Co-authored-by: waleedlatif1 <waleedlatif1@users.noreply.github.com> Co-authored-by: icecrasher321 <icecrasher321@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> Co-authored-by: Shivam <shivamprajapati035@gmail.com> Co-authored-by: Gaurav Chadha <65453826+Chadha93@users.noreply.github.com> Co-authored-by: root <root@Delta.localdomain>
1 parent 0d30676 commit b5b12ba

File tree

3 files changed

+22
-17
lines changed

3 files changed

+22
-17
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ DATABASE_URL="postgresql://postgres:your_password@localhost:5432/simstudio"
188188

189189
Then run the migrations:
190190
```bash
191+
cd packages/db # Required so drizzle picks correct .env file
191192
bunx drizzle-kit migrate --config=./drizzle.config.ts
192193
```
193194

apps/sim/app/(landing)/components/footer/footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export default function Footer({ fullWidth = false }: FooterProps) {
109109
{FOOTER_BLOCKS.map((block) => (
110110
<Link
111111
key={block}
112-
href={`https://docs.sim.ai/blocks/${block.toLowerCase().replace(' ', '-')}`}
112+
href={`https://docs.sim.ai/blocks/${block.toLowerCase().replaceAll(' ', '-')}`}
113113
target='_blank'
114114
rel='noopener noreferrer'
115115
className='text-[14px] text-muted-foreground transition-colors hover:text-foreground'

apps/sim/lib/webhooks/utils.server.ts

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ async function formatTeamsGraphNotification(
8181
foundWorkflow: any,
8282
request: NextRequest
8383
): Promise<any> {
84-
const notification = body.value[0]
84+
const notification = body.value?.[0]
85+
if (!notification) {
86+
logger.warn('Received empty Teams notification body')
87+
return null
88+
}
8589
const changeType = notification.changeType || 'created'
8690
const resource = notification.resource || ''
8791
const subscriptionId = notification.subscriptionId || ''
@@ -359,7 +363,7 @@ async function formatTeamsGraphNotification(
359363
contentType: mimeType,
360364
size,
361365
})
362-
} catch {}
366+
} catch { }
363367
}
364368
}
365369
}
@@ -634,24 +638,24 @@ export async function formatWebhookInput(
634638

635639
const senderObj = message.from
636640
? {
637-
id: message.from.id,
638-
firstName: message.from.first_name,
639-
lastName: message.from.last_name,
640-
username: message.from.username,
641-
languageCode: message.from.language_code,
642-
isBot: message.from.is_bot,
643-
}
641+
id: message.from.id,
642+
firstName: message.from.first_name,
643+
lastName: message.from.last_name,
644+
username: message.from.username,
645+
languageCode: message.from.language_code,
646+
isBot: message.from.is_bot,
647+
}
644648
: null
645649

646650
const chatObj = message.chat
647651
? {
648-
id: message.chat.id,
649-
type: message.chat.type,
650-
title: message.chat.title,
651-
username: message.chat.username,
652-
firstName: message.chat.first_name,
653-
lastName: message.chat.last_name,
654-
}
652+
id: message.chat.id,
653+
type: message.chat.type,
654+
title: message.chat.title,
655+
username: message.chat.username,
656+
firstName: message.chat.first_name,
657+
lastName: message.chat.last_name,
658+
}
655659
: null
656660

657661
return {

0 commit comments

Comments
 (0)