-
Notifications
You must be signed in to change notification settings - Fork 55
Fix integration test failing on first Dependabot PR run #692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
gh-worker-dd-mergequeue-cf854d
merged 2 commits into
main
from
yiming.luo/fix-integration-test-first-run
Apr 13, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| 'use strict'; | ||
|
|
||
| /** | ||
| * Serverless plugin that intercepts CloudFormation.describeStacks during packaging. | ||
| * | ||
| * When custom Lambda layers are defined, Serverless Framework calls | ||
| * CloudFormation.describeStacks in compareWithLastLayer() to check whether a | ||
| * layer has already been uploaded (an optimisation to avoid re-uploading | ||
| * unchanged layers). The error handler in that function only silences errors | ||
| * whose message contains "does not exist"; any other error – including the | ||
| * "The security token included in the request is invalid" response AWS returns | ||
| * when credentials are absent or invalid – is re-thrown, causing sls package | ||
| * to fail. | ||
| * | ||
| * In snapshot tests we never deploy, so this optimisation is meaningless. | ||
| * This plugin intercepts the describeStacks call and immediately returns a | ||
| * synthetic "does not exist" error, which the Serverless handler treats as a | ||
| * fresh stack and skips the comparison entirely. The rest of the packaging | ||
| * lifecycle is unaffected. | ||
| * | ||
| * This shim exists because Serverless Framework has no credential-free packaging mode | ||
| * when custom layers are defined. Tracked upstream: | ||
| * https://github.com/serverless/serverless/issues/8187 (root cause, open since 2020) | ||
| * https://github.com/serverless/serverless/issues/12969 (feature request for --artifacts-only) | ||
| * If either issue is resolved, this plugin can be removed. | ||
| */ | ||
| class OfflinePackaging { | ||
| constructor(serverless) { | ||
| this.serverless = serverless; | ||
| this.hooks = { | ||
| 'before:package:compileLayers': () => this.patchProvider(), | ||
| }; | ||
| } | ||
|
|
||
| patchProvider() { | ||
| const provider = this.serverless.getProvider('aws'); | ||
| const original = provider.request.bind(provider); | ||
| provider.request = (service, method, params, options) => { | ||
| if (service === 'CloudFormation' && method === 'describeStacks') { | ||
| const stackName = (params && params.StackName) || 'unknown'; | ||
| return Promise.reject(new Error(`Stack with id ${stackName} does not exist`)); | ||
| } | ||
| return original(service, method, params, options); | ||
| }; | ||
| } | ||
| } | ||
|
|
||
| module.exports = OfflinePackaging; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ frameworkVersion: "3" | |
|
|
||
| plugins: | ||
| - ../dist/src | ||
| - ./offline | ||
|
|
||
| provider: | ||
| name: aws | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.