55 Commits

Author SHA1 Message Date
Tom Moor
1f7620c6f5 chore: Add warning if enabling debug logging while filtering it out, closes #6691 2024-03-21 20:11:15 -04:00
Tom Moor
483ede8a01 fix: bind Logger.sanitize 2023-11-26 20:22:16 -05:00
Tom Moor
a1b52e18dd chore: Centralize environment detection 2023-11-09 19:24:16 -05:00
Tom Moor
d8d49f6950 fix: Internal server error during import with nested documents 2023-11-09 19:24:16 -05:00
Tom Moor
bd06e03b1e Added more debugging logs for #5564 2023-09-28 17:36:10 -04:00
Tom Moor
80ef0a38d6 chore: More flakey test improvements (#5801) 2023-09-09 15:30:19 -07:00
Tom Moor
3eb947e9a5 chore: Improve perf of server tests (#5785) 2023-09-06 04:14:49 -07:00
Tom Moor
b7bfc4bb1a chore: Remove optimize imports to allow vite upgrade (#5691) 2023-08-14 11:44:58 -07:00
Tom Moor
5656384cc4 fix: Error logging second parameter used as interpolation parameters 2023-07-08 15:35:06 -04:00
Tom Moor
9a95fa47a0 fix: Error details are not output in development 2023-07-08 10:20:39 -04:00
Tom Moor
89d5527d39 Handle promise linting (#5488) 2023-06-28 17:18:18 -07:00
Tom Moor
831318d941 fix: Invalid LOG_LEVEL in environment results in server crash with no displayed error message
Related: https://github.com/outline/outline/discussions/5466
2023-06-22 09:17:25 -04:00
dependabot[bot]
fbd16d4b9a chore(deps-dev): bump prettier from 2.1.2 to 2.8.8 (#5372)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tom Moor <tom.moor@gmail.com>
2023-05-22 19:14:56 -07:00
Tom Moor
ba2bfc7c89 fix: recursive require in test env 2023-04-27 22:31:12 -04:00
Tom Moor
49d903d6d4 chore: Remove console.log left in code and added eslint rule to prevent it happening again 2023-04-11 22:15:52 -04:00
Tom Moor
db73879918 Assorted cleanup, minor bug fixes, styling fixes, eslint rules (#5165
* fix: Logic error in toast
fix: Remove useless component

* fix: Logout not clearing all stores

* Add icons to notification settings

* Add eslint rule to enforce spaced comment

* Add eslint rule for arrow-body-style

* Add eslint rule to enforce self-closing components

* Add menu to api key settings
Fix: Deleting webhook subscription does not remove from UI
Split webhook subscriptions into active and inactive
Styling updates
2023-04-08 05:25:20 -07:00
Tom Moor
6dd4afccaf fix: Context binding,
closes #5056
2023-03-18 09:17:25 -04:00
Tom Moor
d663b92f2a tsc 2023-03-13 21:08:52 -04:00
Tom Moor
f6ac73a741 Add sanitization to log messages to reduce chance of tokens ending up in server logs 2023-03-13 20:42:22 -04:00
Tom Moor
739a291a46 fix: Cannot read properties of undefined (reading 'message') 2023-02-28 18:55:25 -05:00
Apoorv Mishra
6b00ced48f fix: use LOG_LEVEL to set server log severity (#4937) 2023-02-27 21:36:01 +05:30
Tom Moor
5473b698a4 Inject DataDog trace ID's into logs when enabled 2023-01-29 13:40:26 -05:00
Apoorv Mishra
f4461573de Refactor to accommodate authentication, transaction and pagination states together (#4636)
* fix: refactor to accommodate authentication, transaction and pagination together into ctx.state

* feat: allow passing response type to APIContext
2023-01-04 23:51:44 +05:30
Tom Moor
0d920e02b1 chore: Remove query logging in test env 2023-01-02 21:06:39 -05:00
Tom Moor
05a4f050bb chore: Improve graceful server shutdown (#4625)
* chore: Improve graceful server shutdown

* Replace node timers with custom promise timeout
2022-12-31 13:56:27 -08:00
Tom Moor
cdbc6df485 chore: More tracing improvements 2022-12-31 09:04:45 -05:00
Tom Moor
c6fb764631 chore: Move tracing decorators into the codebase (#4623)
* Vendorize tracing, finally fix service name issues

* Upgrade datadaog-metrics, rename decorators -> tracing

* lint
2022-12-31 04:54:51 -08:00
Tom Moor
0794450596 chore: Fixed case of Metrics import 2022-11-22 23:08:52 -05:00
Tom Moor
7199088d1b fix: Multiplayer changes attributed to incorrect user (#4282)
* fix: Multiplayer changes attributed to the wrong user, performance improvements

* fix: Actually use _last_ editor
2022-10-12 06:19:07 -07:00
Tom Moor
4bb2a8ca1c tsc 2022-09-30 22:44:13 -04:00
Tom Moor
264f19d255 fix: Suppress TooManyRequestsError to error tracker 2022-08-28 21:17:51 +02:00
Tom Moor
a326e0ee88 chore: Rate limiter audit (#3965)
* chore: Rate limiter audit api/users

* Make requests required

* api/collections

* Remove checkRateLimit on FileOperation (now done at route level through rate limiter)

* auth rate limit

* Add metric logging when rate limit exceeded

* Refactor to shared configs

* test
2022-08-14 08:04:04 -07:00
Tom Moor
383bac241e fix: Suppress ForbiddenError in error tracker 2022-07-26 23:18:26 +01:00
Tom Moor
2794057738 fix: Sequelize rejectOnEmpty should result in 404 status 2022-07-26 22:06:47 +01:00
Tom Moor
95f4fb2424 chore: Remove deprecated socket.io-auth (#3780) 2022-07-16 02:27:09 -07:00
Tom Moor
c9af7ff889 fix: Suppress db validation errors in error reporting 2022-07-03 16:03:53 +02:00
Tom Moor
1f3a1d4b86 fix: Improved websockets error handling (#3726)
* fix: Add websocket client error capturing
fix: Incorrect parsing of documentName will never be empty

* fix: Non-present documentId in collaboration route should trigger an error response

* fix: Close unhandled websocket requests
2022-07-03 00:00:59 -07:00
Tom Moor
10f86ed218 feat: Webhooks (#3691)
* Webhooks (#3607)

* Get the migration and the model setup. Also make the sample env file a bit easier to use. Now just requires setting a SECRET_KEY and besides that will boot up from the sample

* WIP: Start getting a Webhook page created. Just the skeleton state right now

* WIP: Getting a form created to create webhooks, need to bring in react-hook-forms now

* WIP: Get library installed and make TS happy

* Get a few checkboxes ready to go

* Get creating and destroying working with a decent start to a frontend

* Didn't mean to enable this

* Remove eslint and fix other random typescript issue

* Rename some events to be more realistic

* Revert these changes

* PR review comments around policies. Also make sure this inherits from IdModel so it actually gets an id

* Allow any admin on the team to edit webhooks

* Start sending some webhooks for some User events

* Make sure the URL is valid

* Start recording webhook deliveries

* Make sure to verify if the subscription is for the type of event we are looking at

* Refactor sending Webhooks and follow better webhook schema

This creates a presenter to unify the format of webhooks. We also
extract the sending of webhooks and recording their deliveries to a
method than can be used by each of the different event type methods

We also add a status to WebhookDelivery since we need to save the record
before we make the HTTP request to get its id. Then once we make the
request and get a response we can update the delivery with the HTTP info

* Turn off a subscription that has failed for the last 25 deliveries

* Get a first spec passing. Found a bug in my returning of promises so good to patch that up now

* This looks nicer

* Get some tests added for the processor

* Add cron task to delete older webhooks

* Add Document Events to the Processor

* Revisions, FileOperations and Collections

* Get all the server side events added to the processor and make Typescript make sure they are all accounted for

* Get all the events added to the Frontend and work on styling them a bit, still needs some love though

* Get UI styled up a bit

* Get events wired up for webhook subscriptions

* Get delete events working and test at least one variant of them

* Get deletes working and actually make sure to send the model id in the webhook

* Remove webhook secrets from this slice

* Add disabled label for subscriptions that are disabled

* Make sure to cascade the delete

* Reorg this file a bit

* Fix association

* I removed secret for the moment

* Apply Copy changes from PR Review

Co-authored-by: Tom Moor <tom.moor@gmail.com>

* Actually apply the copy changes

TIL that if you Resolve a conversation it _also_ removes the 'staged suggestion' from your list on Github

Co-authored-by: Tom Moor <tom.moor@gmail.com>

* Update app/scenes/Settings/Webhooks.tsx

Missed this copy change before

Co-authored-by: Tom Moor <tom.moor@gmail.com>

* Add disabled as yellow badge

* Resolve frontend comments

* Fixup Schema a bit and remove the dependency on the subscription

* Add test to make sure we don't disable until there are enough failures, and fix code to actually do that. Also some test fixes from the json response shape changes

* Fix WebhookDeliveries to store the responses as Text instead of blobs

* Switch to text better for response bodies, this is using the helpers better and makes the code read better

* Move the logic to a task but run in through the processor cause the tests expect that right now, moving the tests over next

* Split up the tests and actually enqueue the events from the WebhookProcessor instead of doing them inline

* Allow any team admin to see any webhook subscription for the team

* Add the indexes based on our lookup patterns

* Run eslint --fix to fix auto correct issues from when I tried to use Github to merge copy changes

* Allow subscriptions to be edited after creation

* Types caught that I didn't add the new event to the webhook processor, also added it to the frontend here

* I think this will get these into the translations file

* Catch a few more translations, use styled components better and remove usage of webhook subscription in the copy

Co-authored-by: Tom Moor <tom.moor@gmail.com>

* fix: tsc
fix: Document model payload empty

* fix: Revision webhook payload
Add custom UA for hooks

* Add webhooks icon, move under Integrations settings
Some spacing fixes

* Add actorId to webhook payloads

* Add View and ApiKey event types

* Spacing tweaks, fix team payload

* fix: Webhook not disabled after 25 failures

* fix: Enable webhook when editing if previously disabled

* fix: Correctly store response headers

* fix: Error in json/parsing/presentation results in hanging 'pending' webhook delivery

* fix: Awkward payload for users.invite webhook

* Add BaseEvent, ShareEvent

* fix: Add share events to form

* fix: Move webhook delivery cleanup to single DB call
Remove some unused abstraction

* Add user, collection, group context to membership webhook events
Some associated refactoring

Co-authored-by: Corey Alexander <coreyja@gmail.com>
2022-06-28 22:44:50 -07:00
Tom Moor
bf0ff6c823 chore: Casing of logger -> Logger as it's an instantiated class 2022-05-21 13:59:23 +01:00
Tom Moor
3c002f82cc chore: Centralize env parsing, validation, defaults, and deprecation notices (#3487)
* chore: Centralize env parsing, defaults, deprecation

* wip

* test

* test

* tsc

* docs, more validation

* fix: Allow empty REDIS_URL (defaults to localhost)

* test

* fix: SLACK_MESSAGE_ACTIONS not bool

* fix: Add SMTP port validation
2022-05-19 08:05:11 -07:00
Tom Moor
11477a1185 chore: Centralize clientside logging 2022-04-25 23:31:30 -07:00
Tom Moor
b1aba32b62 chore: Bringing across edits from enterprise codebase 2022-04-16 19:46:01 -07:00
Tom Moor
4c4b80ba9b fix: Collaboration debounce shared between docs (#3401)
* fix: Collaboration debounce shared between docs

* Rename, Tracing -> Metrics

* Add tracing

* tsc

* fix: Lock document row when loading document in collaboration service incase state needs writing

* fix: Incorrect service name regression
2022-04-16 14:58:17 -07:00
Tom Moor
963475d2b0 fix: Queue retry behavior (#3359)
* fix: Queue retry behavior

* Add default options for task queue
2022-04-10 17:50:42 -07:00
Tom Moor
9281287dba one 2022-04-09 20:25:54 -07:00
Tom Moor
dbfdcd6d23 chore: Refactor worker, emails and data cleanup to task system (#3337)
* Refactor worker, all emails on task system

* fix

* lint

* fix: Remove a bunch of expect-error comments in related tests

* refactor: Move work from utils.gc into tasks

* test

* Add tracing to tasks and processors
fix: DebounceProcessor triggering on all events
Event.add -> Event.schedule
2022-04-06 16:48:28 -07:00
Tom Moor
e6eb43144c chore: Hardcode service name for APM tagging 2022-03-18 22:15:56 -07:00
Tom Moor
15cecf1e53 Upgrade dd-trace, add APM tracing around key commands, fix tags should be attached to root spans (#3243) 2022-03-14 20:03:12 -07:00
Tom Moor
79ba8dad30 chore: Improve tracing 2022-03-08 16:41:02 -08:00
Tom Moor
19e85c63c2 lint, tsc 2021-12-11 12:48:32 -08:00