Skip to content

Commit

Permalink
Merge pull request newrelic#178 from jmartin4563/fix-presigned-url-wo…
Browse files Browse the repository at this point in the history
…rkflow

Fix presigned url workflow
  • Loading branch information
jmartin4563 authored Apr 4, 2023
2 parents 336656e + 8da65ce commit 7a387ee
Show file tree
Hide file tree
Showing 9 changed files with 10,123 additions and 6,780 deletions.
29 changes: 29 additions & 0 deletions merged/aws-sdk/.github/workflows/smoke-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: AWS SDK Smoke Tests

on:
push:
schedule:
- cron: '0 9 * * 1-5'
workflow_dispatch:

jobs:
smoke:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x, 16.x, 18.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm ci
- name: Run Smoke Tests
run: npm run smoke
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
420 changes: 420 additions & 0 deletions merged/aws-sdk/THIRD_PARTY_NOTICES.md

Large diffs are not rendered by default.

17 changes: 15 additions & 2 deletions merged/aws-sdk/lib/v3/smithy-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,24 @@ module.exports = function instrumentSmithyClient(shim, name, resolvedName) {
function getPlugin(shim, config) {
return {
applyToStack: (clientStack) => {
/*
* `finalizeRequest` only happens when an actual HTTP request
* is to be sent over the wire. This used to use the `build` step,
* but that caused headaches with using Presigned URLs, which
* leverages the `build` step in its logic. This caused x-new-relic-disable-dt
* to be added as a Signed Header to the Presigned URL, which broke customers' code
* because Signed Headers must be provided when calling the Presigned URL.
*
* See:
* - https://github.com/newrelic/node-newrelic/issues/1571
* - https://aws.amazon.com/blogs/developer/middleware-stack-modular-aws-sdk-js/
*/
clientStack.add(headerMiddleware.bind(null, shim), {
name: 'NewRelicHeader',
step: 'build'
step: 'finalizeRequest',
priority: 'low'
})

clientStack.add(attrMiddleware.bind(null, shim, config), {
name: 'NewRelicDeserialize',
step: 'deserialize'
Expand All @@ -55,7 +69,6 @@ function headerMiddleware(shim, next) {
return async function wrappedHeaderMw(args) {
// this is an indicator in the agent http-outbound instrumentation
// to disable DT from AWS requests as they are not necessary
// This header will be removed before the http request goes over the wire
args.request.headers['x-new-relic-disable-dt'] = 'true'
return await next(args)
}
Expand Down
Loading

0 comments on commit 7a387ee

Please sign in to comment.