uselotus / lotus

Open Source Pricing & Packaging Infrastructure
https://www.uselotus.io
MIT License
1.73k stars 126 forks source link

Subscription endpoint 500 #780

Closed devel-pa closed 11 months ago

devel-pa commented 11 months ago

Accessing http://localhost/api/subscriptions/ displays a 500 error

To Reproduce Steps to reproduce the behavior:

  1. Access the endpoint

Desktop (please complete the following information):

Additional context

2023-12-18 00:02:38 Traceback (most recent call last):
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner
2023-12-18 00:02:38     response = get_response(request)
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 220, in _get_response
2023-12-18 00:02:38     response = response.render()
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/template/response.py", line 114, in render
2023-12-18 00:02:38     self.content = self.rendered_content
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/rest_framework/response.py", line 70, in rendered_content
2023-12-18 00:02:38     ret = renderer.render(self.data, accepted_media_type, context)
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/rest_framework/renderers.py", line 724, in render
2023-12-18 00:02:38     context = self.get_context(data, accepted_media_type, renderer_context)
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/rest_framework/renderers.py", line 696, in get_context
2023-12-18 00:02:38     'post_form': self.get_rendered_html_form(data, view, 'POST', request),
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/rest_framework/renderers.py", line 511, in get_rendered_html_form
2023-12-18 00:02:38     return self.render_form_for_serializer(serializer)
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/rest_framework/renderers.py", line 518, in render_form_for_serializer
2023-12-18 00:02:38     return form_renderer.render(
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/rest_framework/renderers.py", line 372, in render
2023-12-18 00:02:38     return template.render(context)
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/template/backends/django.py", line 62, in render
2023-12-18 00:02:38     return self.template.render(context)
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 175, in render
2023-12-18 00:02:38     return self._render(context)
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 167, in _render
2023-12-18 00:02:38     return self.nodelist.render(context)
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 1000, in render
2023-12-18 00:02:38     return SafeString("".join([node.render_annotated(context) for node in self]))
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 1000, in <listcomp>
2023-12-18 00:02:38     return SafeString("".join([node.render_annotated(context) for node in self]))
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 958, in render_annotated
2023-12-18 00:02:38     return self.render(context)
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/template/defaulttags.py", line 238, in render
2023-12-18 00:02:38     nodelist.append(node.render_annotated(context))
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 958, in render_annotated
2023-12-18 00:02:38     return self.render(context)
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/template/defaulttags.py", line 322, in render
2023-12-18 00:02:38     return nodelist.render(context)
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 1000, in render
2023-12-18 00:02:38     return SafeString("".join([node.render_annotated(context) for node in self]))
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 1000, in <listcomp>
2023-12-18 00:02:38     return SafeString("".join([node.render_annotated(context) for node in self]))
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 958, in render_annotated
2023-12-18 00:02:38     return self.render(context)
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/template/library.py", line 239, in render
2023-12-18 00:02:38     output = self.func(*resolved_args, **resolved_kwargs)
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/rest_framework/templatetags/rest_framework.py", line 87, in render_field
2023-12-18 00:02:38     return renderer.render_field(field, style)
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/rest_framework/renderers.py", line 351, in render_field
2023-12-18 00:02:38     return template.render(context)
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/template/backends/django.py", line 62, in render
2023-12-18 00:02:38     return self.template.render(context)
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 175, in render
2023-12-18 00:02:38     return self._render(context)
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 167, in _render
2023-12-18 00:02:38     return self.nodelist.render(context)
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 1000, in render
2023-12-18 00:02:38     return SafeString("".join([node.render_annotated(context) for node in self]))
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 1000, in <listcomp>
2023-12-18 00:02:38     return SafeString("".join([node.render_annotated(context) for node in self]))
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 958, in render_annotated
2023-12-18 00:02:38     return self.render(context)
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/template/defaulttags.py", line 189, in render
2023-12-18 00:02:38     values = self.sequence.resolve(context, ignore_failures=True)
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 712, in resolve
2023-12-18 00:02:38     obj = self.var.resolve(context)
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 842, in resolve
2023-12-18 00:02:38     value = self._resolve_lookup(context)
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 909, in _resolve_lookup
2023-12-18 00:02:38     current = current()
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/rest_framework/relations.py", line 220, in iter_options
2023-12-18 00:02:38     self.get_choices(cutoff=self.html_cutoff),
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/rest_framework/relations.py", line 202, in get_choices
2023-12-18 00:02:38     return OrderedDict([
2023-12-18 00:02:38   File "/usr/local/lib/python3.9/site-packages/rest_framework/relations.py", line 204, in <listcomp>
2023-12-18 00:02:38     self.to_representation(item),
2023-12-18 00:02:38   File "/lotus/metering_billing/serializers/serializer_utils.py", line 166, in to_representation
2023-12-18 00:02:38     elif isinstance(obj, Plan) and obj.addon_spec is None:
2023-12-18 00:02:38 AttributeError: 'Plan' object has no attribute 'addon_spec'
mnida commented 11 months ago

Thank you for bringing this up @devel-pa . Going to take a crack at it today.

devel-pa commented 11 months ago

Wow, super fast :smile: One extra question, pls: there is any architecture page in the docs to explain how this thing works? Thanks,

Paul

diego-escobedo commented 11 months ago
Screenshot 2023-12-18 at 1 09 01 PM

These are the different components of the architecture! Don't have any section in the docs for it right now