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

Unable to pull variables in manual sync approach #4

Closed
neyara opened this issue Oct 15, 2022 · 5 comments
Closed

Unable to pull variables in manual sync approach #4

neyara opened this issue Oct 15, 2022 · 5 comments
Assignees

Comments

@neyara
Copy link

neyara commented Oct 15, 2022

Hey there,

I was following Infisical's doc and, at first, tried the auto sync approach in my NestJS project. Everything seemed to work fine (it asked for credentials and the project's ID), but the .env.infisical file content was just the project ID and no variables.

So then I tried the manual approach where I emptied the env file and executed npx infisical pull dev, and as a result, I got the following message: The "path" argument must be of type string. Received undefined. This time no info about credentials or project ID was asked (maybe because I informed it in the previous step?). Also, the env file remained empty.

@dangtony98
Copy link
Collaborator

dangtony98 commented Oct 15, 2022

Hey neyara!

Sorry to hear about the trouble ... So to clarify:

  • The .env.infisical file should contain an ID to your project/workspace on Infisical; it won't be populated with your variables.
  • You're right that in the previous step, once it's been informed then it won't ask you again for that information. The .env file should've been populated though, so that's strange.

We always recommend using Infisical with the automatic approach. In our case, since you're using NestJS, you'd want to modify your package.json file dev script to the following:

"start:dev": "npx infisical dev nest start --watch"

Afterward, you should be able top run "npm run start:dev" to start up your development server.

Can you hop over to our Slack channel here? — I'd be more than happy to assist you in real-time!

@neyara
Copy link
Author

neyara commented Oct 15, 2022

Oh, I didn't realize the .env.infisical was actually supposed to have the project ID... And I had deleted it before executing npx infisical pull dev since I mistakenly thought it was the "default" env file when using Infisical. I guess that would explain why I'm getting the "undefined" error now. Is there a way to regenerate this file (.env.infisical)? I tried recreating it manually, but the error still persists.

@dangtony98
Copy link
Collaborator

dangtony98 commented Oct 15, 2022

You should be able to modify the dev script in your package.json as above with "start:dev": "npx infisical dev nest start --watch" and run npm run start-dev in your command line. It'll recognize that the .env.infisical file is missing and prompt you to input your workspace/project ID again!

@dangtony98 dangtony98 self-assigned this Oct 15, 2022
@neyara
Copy link
Author

neyara commented Oct 15, 2022

Thanks, that worked! Even though the .env file was not filled visually, the project started with no complaints 😅
I'll keep investigating, I may have missed something. But I appreciate your help 😄

@dangtony98
Copy link
Collaborator

dangtony98 commented Oct 15, 2022

Yay! That's awesome — The automatic approach works like magic 🙂

We support .env files as well (you'd have to manually type npx infisical pull dev to update or reconstruct it locally) but, to be honest, the automatic approach way better because you and your team can stay in sync with the right set of environment variables at all times!

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

No branches or pull requests

2 participants