Skip to content

Commit

Permalink
Enable sourcemaps for legible stack traces in lambdas
Browse files Browse the repository at this point in the history
  • Loading branch information
lpsinger committed Dec 10, 2024
1 parent 7312c55 commit 4708b92
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/email-incoming/circulars/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { tables } from '@architect/functions'
import 'source-map-support/register'

import {
bodyIsValid,
Expand Down
1 change: 1 addition & 0 deletions app/email-incoming/support/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
transformRecipients,
/* @ts-expect-error: aws-lambda-ses-forwarder does not have type definitions */
} from 'aws-lambda-ses-forwarder'
import 'source-map-support/register'

import { createEmailIncomingMessageHandler } from '../handler'
import { getEnvOrDie, hostname } from '~/lib/env.server'
Expand Down
1 change: 1 addition & 0 deletions app/scheduled/ads/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
import { tables } from '@architect/functions'
import { ConditionalCheckFailedException } from '@aws-sdk/client-dynamodb'
import 'source-map-support/register'

import { getEnvOrDie } from '~/lib/env.server'

Expand Down
2 changes: 2 additions & 0 deletions app/scheduled/circulars/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
import 'source-map-support/register'

import { forAllCirculars } from './actions'
import { sitemapAction } from './actions/sitemap'
import { statsAction } from './actions/stats'
Expand Down
1 change: 1 addition & 0 deletions app/table-streams/circulars/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { search as getSearchClient } from '@nasa-gcn/architect-functions-search'
import { errors } from '@opensearch-project/opensearch'
import type { DynamoDBRecord } from 'aws-lambda'
import 'source-map-support/register'

import { unmarshallTrigger } from '../utils'
import { send as sendKafka } from '~/lib/kafka.server'
Expand Down
1 change: 1 addition & 0 deletions app/table-streams/synonyms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { search as getSearchClient } from '@nasa-gcn/architect-functions-search'
import { errors } from '@opensearch-project/opensearch'
import type { DynamoDBRecord } from 'aws-lambda'
import 'source-map-support/register'

import { unmarshallTrigger } from '../utils'
import { createTriggerHandler } from '~/lib/lambdaTrigger.server'
Expand Down
3 changes: 2 additions & 1 deletion esbuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ const options = {
platform: 'node',
target: ['node20'],
minify: !dev,
sourcemap: dev,
sourcemap: true,
sourcesContent: false,
metafile: true,
loader: { '.node': 'empty' },
plugins: [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"license": "Apache-2.0",
"scripts": {
"build:remix": "remix build && mv build/server/metafile.* build/",
"build:remix": "remix build --sourcemap && mv build/server/metafile.* build/",
"build:sass": "sass -Inode_modules/nasawds/src/theme -Inode_modules/@uswds -Inode_modules/@uswds/uswds/packages app:app",
"build:esbuild": "node esbuild.js",
"build:website": "run-s build:sass build:remix",
Expand Down
3 changes: 1 addition & 2 deletions server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import { type RequestHandler, createRequestHandler } from '@remix-run/architect'
import * as build from '@remix-run/dev/server-build'
import { installGlobals } from '@remix-run/node'
import { type APIGatewayProxyStructuredResultV2 } from 'aws-lambda'
import sourceMapSupport from 'source-map-support'
import 'source-map-support/register'

sourceMapSupport.install()
installGlobals({ nativeFetch: true })

const remixHandler = createRequestHandler({
Expand Down

0 comments on commit 4708b92

Please sign in to comment.