Skip to content
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

fix: init project doesn't replace stage #3554

Merged
merged 2 commits into from
Dec 12, 2023
Merged

Conversation

justindra
Copy link
Contributor

So I noticed that when calling initProject twice, it seems to replace some values but not all of it.

Here's how to re-create it:

import { useProject, initProject } from 'sst/project';

await initProject({ stage: 'prod' });
const project = useProject();

console.log(project);

await initProject({ stage: 'justin' });
const project2 = useProject();

console.log(project2);

What I see logged out is that everything is the same between the 2 stages except for the config.profile. But if we deleted the SST_STAGE env variable before initiating the project a 2nd time, it works as expected. I think if we are passing in a config, it should take precedent before the SST_STAGE env variable. Either way, it's weird that the profile changes but not the stage.

My use case is: I'm writing a script that let's me migrate data between different environments. E.g. Migrate User Xs data from prod to dev, so that I can debug the issue.

Copy link

changeset-bot bot commented Dec 5, 2023

🦋 Changeset detected

Latest commit: ca6444f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
sst Patch
@sst/console Patch
create-sst Patch
astro-sst Patch
svelte-kit-sst Patch
solid-start-sst Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jayair
Copy link
Contributor

jayair commented Dec 6, 2023

I'll send it to Dax

@justindra
Copy link
Contributor Author

Just added a way to reset the lazy caching by setting SST_RESET_LAZY environment variable to force it to never cache anything.

@thdxr thdxr merged commit 7d2f92b into sst:master Dec 12, 2023
1 check passed
@github-actions github-actions bot mentioned this pull request Dec 12, 2023
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.

None yet

3 participants