Skip to content

Conversation

@mbfreder
Copy link
Contributor

Problem

When --watch flag is used, the sync process remains alive. The region and stack_name info get written to config file only after the process finishes. This means customer would not be able to see (or refresh) the latest deployed resoures during the sync process.

Solution

Write to samconfig.toml before running sam sync


License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@mbfreder mbfreder requested a review from a team as a code owner November 22, 2024 16:10
@github-actions
Copy link

  • This pull request implements a feat or fix, so it must include a changelog entry (unless the fix is for an unreleased feature). Review the changelog guidelines.
    • Note: beta or "experiment" features that have active users should announce fixes in the changelog.
    • If this is not a feature or fix, use an appropriate type from the title guidelines. For example, telemetry-only changes should use the telemetry type.

@mbfreder
Copy link
Contributor Author

One test is failing here but not on my local machine. Investigating this.

const { paramsSource, stackName, region, projectRoot } = args
const shouldWriteSyncSamconfigGlobal = paramsSource !== ParamsSource.SamConfig && !!stackName && !!region
if (boundArgs.includes('--watch')) {
shouldWriteSyncSamconfigGlobal && (await writeSamconfigGlobal(projectRoot, stackName, region))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Curious]: Shouldn't we just have the following line before await runInTerminal(sam, 'sync')?

shouldWriteSyncSamconfigGlobal && (await writeSamconfigGlobal(projectRoot, stackName, region))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could, if there's no specific reason why we added that line after running the command.

Copy link
Contributor

@vicheey vicheey Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding past commit here for historical context:

Auto refresh feature trigger extension to fetch for deployed stack node
using stack_name and region from samconfig.toml file. In current
logic, the stack_name and region are written before deployment
process completed to avoid the edge case when deployment failure due to
stack up-to-date. However, this order triggers the extension to fetch
for stack that may not already been created and through an error toast
message to customer stating "Stack does not exist".

Above is the reason we only save stack_name and region info after deploy/sync process completes. For the case of using --watch with sync, we can proceed with current approach.

@nkomonen-amazon nkomonen-amazon merged commit 3b45960 into aws:master Nov 27, 2024
24 of 25 checks passed
prompterTester.assertCallAll()
})

it('[entry: command palette] specify and save flag (with --watch) should save params before starting SAM process', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

95% of the 100 lines in this test are identical to the test above it. The Copy-Paste Detection CI job warned about this. This is not acceptable in this codebase.

@@ -0,0 +1,4 @@
{
"type": "Bug Fix",
"description": "appBuilder refresh feature doesnt work during sync --watch"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this description meaningful to customers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants