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

[Bug]: create_app returns 500 Internal Server Error #16

Closed
1 task done
makmac213 opened this issue Mar 27, 2023 · 4 comments
Closed
1 task done

[Bug]: create_app returns 500 Internal Server Error #16

makmac213 opened this issue Mar 27, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@makmac213
Copy link

makmac213 commented Mar 27, 2023

What happened?

We are building a multi-tenant application and we want to create a Onesignal app via api. The create_app function returns 500 error status.

image

`
def create_onesignal_app(tenant):
configuration = onesignal.Configuration(
user_key=settings.ONE_SIGNAL_USER_AUTH_KEY
)
with onesignal.ApiClient(configuration) as api_client:
hostname = get_hostname(tenant)
default_url = f"https://{hostname}"

    api_instance = default_api.DefaultApi(api_client)
    app = App(
        name=tenant.subdomain,
        chrome_web_origin=default_url,
        chrome_web_default_notification_icon='./static/notification/odzi-onesignal.png',
        site_name=tenant.subdomain,
        apns_p8=''
    )
    try:
        api_response = api_instance.create_app(app)
    except onesignal.ApiException as e:
        # notify_exception_to_admin('@create_onesignal_app')
        print(e)

`

Steps to reproduce?

1. Try to create an app using create_app

What did you expect to happen?

I expected the API to create an app or provide error messages so that I can fix what the errors that I may have caused.

Relevant log output

Status Code: 500
Reason: Internal Server Error
HTTP response headers: HTTPHeaderDict({'Date': 'Mon, 27 Mar 2023 02:15:57 GMT', 'Content-Type': 'application/json; charset=UTF-8', 'Content-Length': '46', 'Connection': 'keep-alive', 'vary': 'Origin', 'x-request-id': 'f5aae66b-5f6d-4fd3-8c43-d83a1ad72793', 'x-runtime': '0.566735', 'Via': '1.1 google', 'Alt-Svc': 'h3=":443"; ma=86400, h3-29=":443"; ma=86400', 'CF-Cache-Status': 'DYNAMIC', 'Set-Cookie': '__cf_bm=SlqzXoBa8mMnIbGjHADK41NqkpN4E0tIxCY1_C2JaYo-1679883357-0-AZ0xw4NBT3NNt0X9Zl7nb6ODh3XqQpdw2+Eyf7z1Q58kNeHIdZPSaDd1tXQjAAMwLBQBtCDmVayLftoU63GfoAM=; path=/; expires=Mon, 27-Mar-23 02:45:57 GMT; domain=.onesignal.com; HttpOnly; Secure; SameSite=None', 'Strict-Transport-Security': 'max-age=15552000; includeSubDomains', 'Server': 'cloudflare', 'CF-RAY': '7ae420e3aeac4553-CGY'})
HTTP response body: {"status":500,"error":"Internal Server Error"}

Code of Conduct

  • I agree to follow this project's Code of Conduct
@makmac213 makmac213 added the bug Something isn't working label Mar 27, 2023
@makmac213
Copy link
Author

Just an update. When I tried again this function it does create an app, I confirmed on the dashboard it does. The only issue at the moment is the response that I got which is still the 500 internal server error message.

@emawby
Copy link

emawby commented Apr 18, 2023

Thank you for reporting we will investigate

@luis-kaufmann-silva
Copy link

If it helps, let me share few other details about same issue here:
Sounds like the problem is related with apns_p8. If you try create the app without it works fine, then if you try to update the apns_p8 to something invalid the system raise 500 error. I took few tries to realize that my apns_p8 was invalid and not base64 encoded.

@emawby
Copy link

emawby commented Jun 12, 2023

Oh very interesting does a valid p8 work as expected?

@nan-li nan-li closed this as completed Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants