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

Migrations Fail When Deploying to AWS with NodeNotFoundError #205

Closed
infiniteNIL opened this issue Nov 16, 2022 · 5 comments
Closed

Migrations Fail When Deploying to AWS with NodeNotFoundError #205

infiniteNIL opened this issue Nov 16, 2022 · 5 comments

Comments

@infiniteNIL
Copy link

Everything works fine locally, but when I attempt to deploy to AWS Elastic Beanstalk, migrations fail. The following is from the log:

2022-11-13 23:43:33,659 P31312 [INFO] Command 01_makemigrations
2022-11-13 23:43:34,219 P31312 [INFO] -----------------------Command Output-----------------------
2022-11-13 23:43:34,220 P31312 [INFO] Traceback (most recent call last):
2022-11-13 23:43:34,220 P31312 [INFO] File "manage.py", line 22, in
2022-11-13 23:43:34,220 P31312 [INFO] main()
2022-11-13 23:43:34,220 P31312 [INFO] File "manage.py", line 18, in main
2022-11-13 23:43:34,220 P31312 [INFO] execute_from_command_line(sys.argv)
2022-11-13 23:43:34,220 P31312 [INFO] File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/core/management/init.py", line 446, in execute_from_command_line
2022-11-13 23:43:34,220 P31312 [INFO] utility.execute()
2022-11-13 23:43:34,220 P31312 [INFO] File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/core/management/init.py", line 440, in execute
2022-11-13 23:43:34,220 P31312 [INFO] self.fetch_command(subcommand).run_from_argv(self.argv)
2022-11-13 23:43:34,220 P31312 [INFO] File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/core/management/base.py", line 414, in run_from_argv
2022-11-13 23:43:34,220 P31312 [INFO] self.execute(*args, **cmd_options)
2022-11-13 23:43:34,220 P31312 [INFO] File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/core/management/base.py", line 460, in execute
2022-11-13 23:43:34,220 P31312 [INFO] output = self.handle(*args, **options)
2022-11-13 23:43:34,220 P31312 [INFO] File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/core/management/base.py", line 98, in wrapped
2022-11-13 23:43:34,221 P31312 [INFO] res = handle_func(*args, **kwargs)
2022-11-13 23:43:34,221 P31312 [INFO] File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/core/management/commands/makemigrations.py", line 100, in handle
2022-11-13 23:43:34,221 P31312 [INFO] loader = MigrationLoader(None, ignore_no_migrations=True)
2022-11-13 23:43:34,221 P31312 [INFO] File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/db/migrations/loader.py", line 58, in init
2022-11-13 23:43:34,221 P31312 [INFO] self.build_graph()
2022-11-13 23:43:34,221 P31312 [INFO] File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/db/migrations/loader.py", line 276, in build_graph
2022-11-13 23:43:34,221 P31312 [INFO] self.graph.validate_consistency()
2022-11-13 23:43:34,221 P31312 [INFO] File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/db/migrations/graph.py", line 198, in validate_consistency
2022-11-13 23:43:34,221 P31312 [INFO] [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
2022-11-13 23:43:34,221 P31312 [INFO] File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/db/migrations/graph.py", line 198, in
2022-11-13 23:43:34,221 P31312 [INFO] [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
2022-11-13 23:43:34,221 P31312 [INFO] File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/db/migrations/graph.py", line 60, in raise_error
2022-11-13 23:43:34,221 P31312 [INFO] raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
2022-11-13 23:43:34,221 P31312 [INFO] django.db.migrations.exceptions.NodeNotFoundError: Migration webapp.0032_invitationdetails_installer_invitation_and_more dependencies reference nonexistent parent node ('invitations', '0004_alter_invitation_id')

It just seems like it can't find the migrations for invitations. I have verified that they are in the venv/lib/site-packages/invitations/migrations.

Am I missing a setting or command argument or something or is this a bug in Django or Invitations? Any workarounds?

Thanks. I'm pretty new to Django.

kalzun added a commit to kalzun/django-invitations that referenced this issue Nov 30, 2022
@kalzun
Copy link

kalzun commented Nov 30, 2022

Yes, this due to a change in Django in 3.2 (release notes for 3.2).

The settings in the default settings file is now setting models missing a primary_key to DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField', the package will make a migration of this when you run python manage.py makemigrations locally. This migration is missing in AWS Beanstalk.

I encountered the similar problem, when installing from requirements.txt, the migration for this change is missing.

I have made a pull request #206 to the project, maybe that can help you.
It will not need a migration file - you still have to do a manual job to fix the migration file that reference ('invitations', '0004_alter_invitation_id')

@mitch-PV01
Copy link

This is still an issue, running makemigrations locally when using BigAutoField will generate invitations/migrations/0004_alter_invitation_id.py inside site_packages. Can this migration be committed to the repo?

@valberg
Copy link
Contributor

valberg commented Mar 28, 2023

This has been fixed in #211 and will be included in a release soon.

@valberg valberg closed this as completed Mar 28, 2023
@KrYpTeD974
Copy link

@valberg, Could you please release a new version with this fix ? The 2.0.0 is not usable in production in the current state.

@valberg
Copy link
Contributor

valberg commented Nov 22, 2023

Hi! I have just issued 2.1.0 release. I hope this fixes your problem. Sorry for the delay.

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

5 participants