Skip to content

Server Folder Naming Restriction Migration Issue (Not a server package) #1846

Open

Description

@Lightgaming

I migrated my existing Serverpod project to 1.2.2 and followed the migration guide

When I tried to create a migration, I got this Error:

Yikes! It is possible that this error is caused by an internal issue with the Serverpod tooling. We would appreciate if you filed an issue over at Github. Please include the stack trace
below and describe any steps you did to trigger the error.
https://github.com/serverpod/serverpod/issues

Exception: Not a server package (server)

#0      moduleNameFromServerPackageName (package:serverpod_cli/src/util/locate_modules.dart:169:5)
#1      MigrationGenerator._extractModuleNameFromPath (package:serverpod_cli/src/migrations/generator.dart:387:12)
#2      MigrationGenerator._loadMigrationVersionsFromModules.<anonymous closure> (package:serverpod_cli/src/migrations/generator.dart:331:26)
#3      WhereIterator.moveNext (dart:_internal/iterable.dart:451:13)
#4      MigrationGenerator._loadMigrationVersionsFromModules (package:serverpod_cli/src/migrations/generator.dart:338:28)
<asynchronous suspension>
#5      MigrationGenerator._loadModuleDatabaseDefinitions (package:serverpod_cli/src/migrations/generator.dart:147:20)
<asynchronous suspension>
#6      MigrationGenerator.createMigration (package:serverpod_cli/src/migrations/generator.dart:82:31)
<asynchronous suspension>
#7      CreateMigrationCommand.run.<anonymous closure> (package:serverpod_cli/src/commands/create_migration.dart:72:21)
<asynchronous suspension>
#8      StdOutLogger.progress (package:serverpod_cli/src/logger/loggers/std_out_logger.dart:131:20)

So I checked your codebase for the Exception name and found the code that is responsible for this.

(serverpod/serverpod/tools/serverpod_cli/lib/src/util/locate_modules.dart:168)

if (!packageName.endsWith(_serverSuffix)) {
  throw Exception('Not a server package ($packageName)');
}

I got this issue because I renamed the folders to app, client and server (which I find more concise and readable)

The fix was to add a "_server" suffix to whatever I named the server package. (Like "myapp_server")

So my question is:

Is there a reason why you designed it this way, and could you make it so you can have any name?

Activity

  1. added
    enhancement
    on Feb 5, 2024
  2. vlidholt commented on Feb 5, 2024

    @vlidholt
    Collaborator

    I'm not sure how hard this would be to fix. It would be nice to be able to rename the packages, but it may not be the highest priority on our list. We will have a look to see if it's a quick fix. :)

  3. added
    area: configuration
    on Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: configurationenhancement

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions