npx nx workspace:seed:demo doesn't exist

I'm trying to write automated scenario according to bullet points here but I can't seed my database by running npx nx workspace:seed:demo (command taken from https://github.com/twentyhq/twenty/discussions/6467), is this command correct? Logs from --verbose:
Error: Cannot find configuration for task twenty:workspace:seed:demo
at ProcessTasks.createTask (/home/user/Desktop/projects/twenty/node_modules/nx/src/tasks-runner/create-task-graph.js:156:19)
at ProcessTasks.processTasks (/home/user/Desktop/projects/twenty/node_modules/nx/src/tasks-runner/create-task-graph.js:23:39)
at createTaskGraph (/home/user/Desktop/projects/twenty/node_modules/nx/src/tasks-runner/create-task-graph.js:195:21)
at createTaskGraphAndValidateCycles (/home/user/Desktop/projects/twenty/node_modules/nx/src/tasks-runner/run-command.js:62:63)
at /home/user/Desktop/projects/twenty/node_modules/nx/src/tasks-runner/run-command.js:86:27
at handleErrors (/home/user/Desktop/projects/twenty/node_modules/nx/src/utils/params.js:9:22)
at runCommand (/home/user/Desktop/projects/twenty/node_modules/nx/src/tasks-runner/run-command.js:83:52)
at Object.runOne (/home/user/Desktop/projects/twenty/node_modules/nx/src/command-line/run/run-one.js:50:59)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async handleErrors (/home/user/Desktop/projects/twenty/node_modules/nx/src/utils/params.js:9:16)
Error: Cannot find configuration for task twenty:workspace:seed:demo
at ProcessTasks.createTask (/home/user/Desktop/projects/twenty/node_modules/nx/src/tasks-runner/create-task-graph.js:156:19)
at ProcessTasks.processTasks (/home/user/Desktop/projects/twenty/node_modules/nx/src/tasks-runner/create-task-graph.js:23:39)
at createTaskGraph (/home/user/Desktop/projects/twenty/node_modules/nx/src/tasks-runner/create-task-graph.js:195:21)
at createTaskGraphAndValidateCycles (/home/user/Desktop/projects/twenty/node_modules/nx/src/tasks-runner/run-command.js:62:63)
at /home/user/Desktop/projects/twenty/node_modules/nx/src/tasks-runner/run-command.js:86:27
at handleErrors (/home/user/Desktop/projects/twenty/node_modules/nx/src/utils/params.js:9:22)
at runCommand (/home/user/Desktop/projects/twenty/node_modules/nx/src/tasks-runner/run-command.js:83:52)
at Object.runOne (/home/user/Desktop/projects/twenty/node_modules/nx/src/command-line/run/run-one.js:50:59)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async handleErrors (/home/user/Desktop/projects/twenty/node_modules/nx/src/utils/params.js:9:16)
21 Replies
ɃØĦɆᵾS
ɃØĦɆᵾS2mo ago
Now I kinda debugged it and when I run yarn command:prod workspace:seed:demo it runs correctly but there still is an error Error: Could not get DEMO_WORKSPACE_IDS. Please specify in .env
charles
charles2mo ago
@ɃØĦɆᵾS if you are contributing you should use nx: npx nx run twenty-server:command workspace:seed:demo (this will make sure your server is properly built) If you are self-hosting (everything is pre-built for you) you should use yarn : yarn comand:prod workspace:seed:demo this two ways to execute the same command this command needs DEMO_WORKSPACE_IDS to be set in your env variable. If you are contributing it should be in your .env DEMO_WORKSPACE_IDS={a_valid_uuid} If you are self-hosting, it should be in your environment variables directly
ɃØĦɆᵾS
ɃØĦɆᵾS2mo ago
Okay, I'll get back once I have some time to test this
charles
charles2mo ago
thanks @ɃØĦɆᵾS! The tests need you 😄
ɃØĦɆᵾS
ɃØĦɆᵾS2mo ago
Also, I have a question, why author of linked discussion uses both yarn and npx?
charles
charles2mo ago
mmmh good point, as these are dev tasks they should be run using npx nx run otherwise we can't be sure it's properly built or we can't leverage monorepo caching provided by nx updated I'm taking a look to your post on the discussion
ɃØĦɆᵾS
ɃØĦɆᵾS2mo ago
Thanks a lot
charles
charles2mo ago
thank you!
ɃØĦɆᵾS
ɃØĦɆᵾS2mo ago
@charles checked and both yarn and npx commands are working now as expected, so all yarn commands should be replaced with npx?
charles
charles2mo ago
In contributor mode use nx: npx nx run package:command In production (self-host) mode: use yarn directly (nx should not be used) Here is the rational: - while contributing we want to execute commands / build on fresh code. So we are watching files, making sure that they are properly built. As project start to grow, we split it into package and packages start to have dependencies. For instance twenty-front depends on twenty-ui. While working on twenty-front, we need to make sure that twenty-front AND twenty-ui are properly built. This starts being slow and does not scale well. Nx enables us to cache command outputs and do not re-execute them if the source file have not change. It's a mono-repo caching tool - so while you contribute you should always use nx. In CIs, we also use nx so developer can run tests or other ci commands easily on their machine - in production mode we don't ship with nx as there is no need to build the project, it's already built in the docker image and you d'ont have any dev tooling. In this case, you have to use yarn commands Also, to make a clear separation: - nx commands are located in project.json / nx.json - yarn commands are located in package.json
ɃØĦɆᵾS
ɃØĦɆᵾS2mo ago
Wow, thanks for such detailed answer! 👍 I'll try to create a PR today once I fix some stuff Also, as I'm working on CI, tests should be performed on localhost or on demo? If localhost, then everything must be built? @charles
charles
charles2mo ago
I think we should do it on demo
ɃØĦɆᵾS
ɃØĦɆᵾS2mo ago
I'm asking because I'm not sure if the instance exists between each workflow or each workflow builds the project independently of others
charles
charles2mo ago
the tests should be executed from a github action runner but targetting a specific workspace on demo that would fit our pre-deployment checklist and provide a stable environment that the core team would maintain (we already maintain demo)
ɃØĦɆᵾS
ɃØĦɆᵾS2mo ago
Okay, what about running commands like resetting database? Is it possible to run them from runner i.e. does runner have (or will have) access to demo's console?
Want results from more Discord servers?
Add your server