opsgenie / opsgenie-configuration-backup

Backup your OpsGenie account's configuration and restore it later
https://opsgenie.com
Apache License 2.0
28 stars 26 forks source link

Could not initiate rate limits. Unexpected character #47

Open DonLav opened 2 years ago

DonLav commented 2 years ago

Hey, I'm trying to run the export tool with the following command: java -jar C:\OpsGenieExportUtil-0.23.6.jar --apiKey mykey --opsgenieHost https://mysite.app.eu.opsgenie.com

I then get the following response: 12:27:43.607 [main] INFO com.opsgenie.tools.backup.ExportMain - Export directory path: C:\ 12:27:43.609 [main] INFO com.opsgenie.tools.backup.ExportMain - Opsgenie host: https://mysite.app.eu.opsgenie.com 12:27:44.330 [main] ERROR com.opsgenie.tools.backup.util.BackupUtils - Could not initiate rate limits. Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false') at [Source: (String)"<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="robots" content="none"/><meta name="viewport" content=""/><meta name="referrer" content="strict-origin-when-cross-origin"/><base href="/"/><link rel="dns-prefetch" href="https://ajax.googleapis.com"/><link rel="dns-prefetch" href="https://og-frontend-static.eu-central-1.prod.public.atl-paas.net"/><title ng-bind="pageTitle ? pageTitle : 'Opsgenie'"></title><script type="text/javascript">"/"!==window.location.pathname&&"/alert"[truncated 25969 chars]; line: 1, column: 2]

My API key is newly created but has all full permissions. I'm running the command from the same location as the .jar. Any help would be greatly appreciated. Thank you in advance.

ghost commented 2 years ago
[luis@fedora backups]$ java -jar OpsGenieExportUtil-0.23.6.jar --apiKey ****************** --backupPath /*****************/export  --opsgenieHost https://api.app.eu.opsgenie.com

WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
21:38:32.526 [main] INFO  com.opsgenie.tools.backup.ExportMain - Export directory path: /home/luis/dev/opsgenie/backups/export
21:38:32.528 [main] INFO  com.opsgenie.tools.backup.ExportMain - Opsgenie host: https://api.app.eu.opsgenie.com
21:38:33.539 [main] ERROR com.opsgenie.tools.backup.util.BackupUtils - Could not initiate rate limits. Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
 at [Source: (String)"<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="robots" content="none"/><meta name="viewport" content=""/><meta name="referrer" content="strict-origin-when-cross-origin"/><base href="/"/><link rel="dns-prefetch" href="https://ajax.googleapis.com"/><link rel="dns-prefetch" href="https://og-frontend-static.eu-central-1.prod.public.atl-paas.net"/><title ng-bind="pageTitle ? pageTitle : 'Opsgenie'"></title><script type="text/javascript">"/"!==window.location.pathname&&"/alert"[truncated 25969 chars]; line: 1, column: 2]
kristoferlandgren commented 1 year ago

I get the same error, @DonLav did you ever get pass this issue?

collynes commented 3 months ago

I recently encountered an issue while using this tool where I kept getting the same error message.

In my scenario, I was exporting configurations to another OpsGenie URL. Since I was working on my laptop, I assumed I needed to specify the URL for the new destination.

By default, the --opsgenieHost URL is set to https://api.opsgenie.com. However, as I am located in the EU, my URL appeared different, like https://api.myorg.app.eu.opsgenie.com.

Therefore, my command looked something like this:

java -jar OpsGenieImportUtil-0.23.9.jar --apiKey MY_API_KEY --opsgenieHost https://api.myorg.app.eu.opsgenie.com

Solution: It turns out, you don't actually need to provide the opsgenieHost parameter. The API Key automatically resolves your project, as indicated in my log:

14:13:42.407 [main] INFO com.opsgenie.tools.backup.ImportMain - Account name is MyOrg