Some Cloudwatch queries - Tue Oct 24202312:57 PM
I self host my Next.js site, and as a result, errors sometimes get gnarly and hard to debug 😅. Here’s a CloudWatch query that I’ve been using to comb through the structured logs that I previously mentioned.
👆 outputs 👇
@timestamp | @module | @level | @message | err |
---|---|---|---|---|
2023-10-24T12:55:54.473Z | (blog)/[...slug]/page.tsx | error | BlogPage failed to render | ENOENT: no such file or directory, open '/var/task/apps/web/posts/tags/terraform-provider.mdx' |
2023-10-24T12:55:53.501Z | (blog)/[...slug]/page.tsx | info | navData compiled | |
... | ... | ... | ... | ... |
Also, TIL that Node.js's console.trace() includes a stack trace... big derp moment.
For tracing, novocaine/sourcemapped-stacktrace looks promising. My hope is that
it'll make tracing back to exact log lines easier, and so that I don’t do a hack, like
passing a filepath to my logger name, as seen in the @module
column.