diff --git a/apps/api/src/project/project.e2e.spec.ts b/apps/api/src/project/project.e2e.spec.ts index 09194156..a5fbc5ef 100644 --- a/apps/api/src/project/project.e2e.spec.ts +++ b/apps/api/src/project/project.e2e.spec.ts @@ -1416,7 +1416,7 @@ describe('Project Controller Tests', () => { expect(devEnvironment.name).toBe(environment.name) expect(defaultEnvironment).toBeDefined() - expect(defaultEnvironment.name).toBe('Default') + expect(defaultEnvironment.name).toBe('default') }) it('should only copy new environments, secrets and variables if sync is not hard', async () => { diff --git a/apps/api/src/project/service/project.service.ts b/apps/api/src/project/service/project.service.ts index ab14e9c2..7cfb2a91 100644 --- a/apps/api/src/project/service/project.service.ts +++ b/apps/api/src/project/service/project.service.ts @@ -162,9 +162,9 @@ export class ProjectService { createEnvironmentOps.push( this.prisma.environment.create({ data: { - name: 'Default', + name: 'default', slug: await generateEntitySlug( - 'Default', + 'default', 'ENVIRONMENT', this.prisma ), diff --git a/apps/platform/src/components/dashboard/project/createProjectDialogue/index.tsx b/apps/platform/src/components/dashboard/project/createProjectDialogue/index.tsx index 40343d2d..7cc4aca3 100644 --- a/apps/platform/src/components/dashboard/project/createProjectDialogue/index.tsx +++ b/apps/platform/src/components/dashboard/project/createProjectDialogue/index.tsx @@ -57,11 +57,19 @@ export default function CreateProjectDialogue(): JSX.Element { // Function to create a new project const createNewProject = useCallback(async () => { if (selectedWorkspace) { - newProjectData.workspaceSlug = selectedWorkspace.slug + // Filter out environments with empty names + const projectData = { + ...newProjectData, + workspaceSlug: selectedWorkspace.slug, + environments: + newProjectData.environments?.filter( + (env) => env.name.trim() !== '' + ) || [] + } const { data, error, success } = await ControllerInstance.getInstance().projectController.createProject( - newProjectData, + projectData, {} )