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

Received a naive datetime #8

Open
medoix opened this issue Aug 18, 2023 · 5 comments
Open

Received a naive datetime #8

medoix opened this issue Aug 18, 2023 · 5 comments

Comments

@medoix
Copy link

medoix commented Aug 18, 2023

I spent some time trying to understand why my API key was not working but i believe that error message [API] Invalid API key or access token (unrecognized login or wrong password) is not correct and is being sent after the failure to parse the date when attempting to create the webhook.

/root/.local/lib/python3.9/site-packages/django/db/models/fields/__init__.py:1358: RuntimeWarning: DateTimeField NotificationEntry.updated received a naive datetime (2023-08-17 00:00:00) while time zone support is active.
  warnings.warn("DateTimeField %s.%s received a naive datetime "
Internal Server Error: /plugin/shopify/webhook/
Traceback (most recent call last):
  File "/root/.local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  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 228, in _webhook_create
    raise KeyError(response)
KeyError: {'errors': '[API] Invalid API key or access token (unrecognized login or wrong password)'}
192.168.1.164 - - [18/Aug/2023:11:33:01 +0000] "GET /plugin/shopify/webhook/ HTTP/1.0" 500 18992 "http://192.168.1.10:3002/settings/"
@medoix
Copy link
Author

medoix commented Aug 19, 2023

So upon further investigation it appears that the webhooks are being created (i can see them in the Admin section as per screenshot). Once i deleted them all that Datetime error above disappeared but am still getting the Invalid API key or access token message when i know the credentials work (have tested them in another app)

image

@matmair
Copy link
Member

matmair commented Aug 20, 2023

@medoix the native datetime thingy is only a warning. The API key probably does not have the right for the APIs the plugin needs, especially if you are using them for another app. Webhooks in InvenTree and Shopify API access are not connected.

To debug this I need more info - it is working for me on a brand-new install. Please post your inventree version information, deployment method and at what step of the instructions you are stuck.

@medoix
Copy link
Author

medoix commented Aug 20, 2023

@matmair the custom app API key and shared secret has full permission access (everything selected).

InvenTree version: 0.12.13

Installed via docker using docker-compose and the files here https://github.com/inventree/InvenTree/tree/master/docker/production

I added the plugin to the polugins.txt file

# InvenTree Plugins (uses PIP framework to install)
inventree-shopify

I did raise a separate ticket because after the plugin was installed i was getting table errors so needed to manually run invoke update

The invoke migrations command returned the following (from the inventree-server container) but the update command appeared to work.

root@e2e263facb02:/home/inventree/InvenTree# invoke migrations
No idea what 'migrations' is!

I have added full scoped API credentials into the Admin
image

When i click on the button to test the Webhooks it appears a webhook is created but i get the error shared in the ticket above
image

image

@matmair
Copy link
Member

matmair commented Aug 22, 2023

@medoix are you sure you have set api key (API key), Api password (admin-api token) and API shared secret (secret API key) correctly? I have repeated the setup on docker and can not find an error.

@matmair
Copy link
Member

matmair commented Aug 24, 2023

@medoix were you able to solve the problem by switching the keys?

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

2 participants