Code Monkey home page Code Monkey logo

advent-of-code-leaderboard-microsoft-teams's Introduction

Hi there ๐Ÿ‘‹

advent-of-code-leaderboard-microsoft-teams's People

Contributors

amclin avatar dependabot[bot] avatar omnisnash avatar patrickrose avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

advent-of-code-leaderboard-microsoft-teams's Issues

Teams webhook rejects boards with more than 16 players

My posts to Teams just stopped working yesterday after working perfectly the day before. GitHub actions were running and completing successfully, but nothing was showing up in Teams. It was like messages were being silently dropped.

When there is an issue sending the leaderboard message to the Teams webhook, this silently completes even if Teams is responding with an error.

So after a LOT of debugging, I discovered that Teams will return an error message in the response body if the submitted POST has an issue. When the POST is successful, the response body will be simply 1 with a 200 status code. But when the POST fails, the response is still a 200 status code (why?!?!?) with an body message along the lines of:

Webhook message delivery failed with error: Microsoft Teams endpoint returned HTTP error 500 with ContextId tcid=0,server=msgapi-production-scus-azsc6-2-194,cv=ImZV3K0Hh0exYBE0orNutw.0,MS-CV=ImZV3K0Hh0exYBE0orNutw.0..

Why Teams wraps a 500 error with a 200 response is beyond me, but hey, at least there's something now to work from.

After a bunch more messing around, I figured out that the cause of the error was because the message was too large. It looks like about 16 users on a leaderboard is the maximum safe size of the message before Teams starts rejecting it. Any more rows and the message was too large. The hard limit is 28 KB: https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook

I have a working solution and will open a PR shortly.

Issue converting response of leaderboard call to JSON

Hi there,

Having an issue converting the body of the response to JSON:

FetchError: invalid json response body at https://adventofcode.com/2020/leaderboard reason: Unexpected token < in JSON at position 0
at C:\Users\james\Documents\GitHub\advent-of-code-leaderboard-microsoft-teams\node_modules\node-fetch\lib\index.js:272:32
at processTicksAndRejections (node:internal/process/task_queues:93:5)
at async requestJsonLeaderboard (C:\Users\james\Documents\GitHub\advent-of-code-leaderboard-microsoft-teams\src\index.js:38:26)
at async C:\Users\james\Documents\GitHub\advent-of-code-leaderboard-microsoft-teams\src\index.js:53:29 {
type: 'invalid-json'
}

By no means a JS wizard, but would love to get this working for my team. Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.