invenhost / inventree-shopify

InvenTree plugin to link inventory with Shopify
MIT License
6 stars 1 forks source link

Plugin Install (No DB Table) #7

Closed sc-steven closed 1 year ago

sc-steven commented 1 year ago

After adding inventree-shopify to the plugins.txt file and restarting my containers docker-compose restart i see the plugin appear and can enable it.

It appears the API keys etc all need to be added via the Admin Settings panel (under the Shopify Integration App section of the plugin menu these values are only shown as red asterisks).

When attempting to open the Webhook URL i get a server error and the error log is below indicating the tables don't exist.

Change Error
Error object (10)
[HISTORY](https://inventree.domain.com/admin/error_report/error/10/history/)

Type:
ProgrammingError
Path:
http://inventree.domain.com/plugin/shopify/webhook/
Info:
relation "inventree_shopify_shopifywebhook" does not exist
LINE 1: INSERT INTO "inventree_shopify_shopifywebhook" ("webhookendp...
^
When:
Aug. 4, 2023, 4:45 a.m.
Data:
Traceback (most recent call last):

File "/root/.local/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)

psycopg2.errors.UndefinedTable: relation "inventree_shopify_shopifywebhook" does not exist
LINE 1: INSERT INTO "inventree_shopify_shopifywebhook" ("webhookendp...
^

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File "/root/.local/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/usr/local/lib/python3.9/site-packages/inventree_shopify/ShopifyPlugin.py", line 173, in view_webhooks
'webhooks': self._webhook_check(request.get_host())

File "/usr/local/lib/python3.9/site-packages/inventree_shopify/ShopifyPlugin.py", line 206, in _webhook_check
self._webhook_create(host, topic)

File "/usr/local/lib/python3.9/site-packages/inventree_shopify/ShopifyPlugin.py", line 217, in _webhook_create
webhook = ShopifyWebhook.objects.create(name=f'{self.slug}_{topic}')

File "/root/.local/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)

File "/root/.local/lib/python3.9/site-packages/django/db/models/query.py", line 453, in create
obj.save(force_insert=True, using=self.db)

File "/root/.local/lib/python3.9/site-packages/django/db/models/base.py", line 739, in save
self.save_base(using=using, force_insert=force_insert,

File "/root/.local/lib/python3.9/site-packages/django/db/models/base.py", line 776, in save_base
updated = self._save_table(

File "/root/.local/lib/python3.9/site-packages/django/db/models/base.py", line 881, in _save_table
results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)

File "/root/.local/lib/python3.9/site-packages/django/db/models/base.py", line 919, in _do_insert
return manager._insert(

File "/root/.local/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)

File "/root/.local/lib/python3.9/site-packages/django/db/models/query.py", line 1270, in _insert
return query.get_compiler(using=using).execute_sql(returning_fields)

File "/root/.local/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1416, in execute_sql
cursor.execute(sql, params)

File "/root/.local/lib/python3.9/site-packages/django/db/backends/utils.py", line 66, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)

File "/root/.local/lib/python3.9/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
return executor(sql, params, many, context)

File "/root/.local/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)

File "/root/.local/lib/python3.9/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value

File "/root/.local/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)

django.db.utils.ProgrammingError: relation "inventree_shopify_shopifywebhook" does not exist
LINE 1: INSERT INTO "inventree_shopify_shopifywebhook" ("webhookendp...
^
matmair commented 1 year ago

It sounds like you have auto-migration turned off. With the provided info it is hard to say though. You can always run migrations with the invoke migrations task - how you call depends on the install path.