Skip to content

Commit

Permalink
Enable sourcemaps for legible stack traces in lambdas
Browse files Browse the repository at this point in the history
Fixes #2769.
  • Loading branch information
lpsinger committed Dec 10, 2024
1 parent 7312c55 commit 2c97c7f
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'

Check warning on line 9 in app/email-incoming/circulars/index.ts

View check run for this annotation

Codecov / codecov/patch

app/email-incoming/circulars/index.ts#L9

Added line #L9 was not covered by tests

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'

Check warning on line 14 in app/email-incoming/support/index.ts

View check run for this annotation

Codecov / codecov/patch

app/email-incoming/support/index.ts#L14

Added line #L14 was not covered by tests

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'

Check warning on line 10 in app/scheduled/ads/index.ts

View check run for this annotation

Codecov / codecov/patch

app/scheduled/ads/index.ts#L10

Added line #L10 was not covered by tests

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'

Check warning on line 8 in app/scheduled/circulars/index.ts

View check run for this annotation

Codecov / codecov/patch

app/scheduled/circulars/index.ts#L8

Added line #L8 was not covered by tests

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'

Check warning on line 11 in app/table-streams/circulars/index.ts

View check run for this annotation

Codecov / codecov/patch

app/table-streams/circulars/index.ts#L11

Added line #L11 was not covered by tests

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 2c97c7f

Please sign in to comment.