UrielCh / api-ovh-node

a TypeScript helper to use OVH API
MIT License
15 stars 5 forks source link

ovh-bill-importer with US API ? #19

Closed verylys closed 2 months ago

verylys commented 1 year ago

Hi !

$ ovh-bill-importer --api us --dest="OVH-US_invoices/" Invoices emit before 2022-01-01 won't be imported [OVH] MISSING_CREDENTIAL issue a new one: 5004e5f14f6c83bedb418675a2d62d24 Please validate certificate with this url to continue: https://www.ovh.com/auth/sso/api?credentialToken=XXXXXXXX

Am I wrong or it should use https://www.ovh.us instead of https://www.ovh.com when "--api us" is used ?

UrielCh commented 1 year ago

That should work like that, but I have no us account so I never try non eu API...

adding the --token param and open the URL should works.

verylys commented 1 year ago

$ ovh-bill-importer --api us --dest="OVH-US_invoices/" --token ovh-us.txt Invoices emit before 2022-01-01 won't be imported [OVH] MISSING_CREDENTIAL issue a new one: ae9526a141c44ddbfb6bbbfa6c50bf83 Please validate certificate with this url to continue: https://www.ovh.com/auth/sso/api?credentialToken=XXXXXXXXX

It does not work, event with the --token option. I tried to manually change the ovh.com to ovh.us when opening the browser (https://www.ovh.us/auth/sso/api?credentialToken=XXXXXXXXX ) , but got a: "Error code: Invalid credential token"

UrielCh commented 1 year ago

may be a screen shoot can help, or at least provide a stack

verylys commented 1 year ago

Sorry but I don't see what can I give you more. --api us should not try to create a certificate on ovh.com but on ovh.us

verylys commented 11 months ago

Hello, still broken for me.

--api us is used as parameter, but host is wrong (host: 'eu.api.ovh.com',)

$ ovh-bill-importer --dest="ovh/" --split=none --concurrency=3 --max-age 365D --api us --token vg_us.json Invoices emit before 2022-10-13 won't be imported Using previous token from vg_us.json OvhError: This application key is invalid in 0.2 Sec. at handleResponse (/usr/local/lib/node_modules/ovh-bill-importer/node_modules/@ovh-api/api/dist/requestHandler.js:112:11) at IncomingMessage. (/usr/local/lib/node_modules/ovh-bill-importer/node_modules/@ovh-api/api/dist/requestHandler.js:143:20) at IncomingMessage.emit (node:events:539:35) at endReadableNT (node:internal/streams/readable:1345:12) at processTicksAndRejections (node:internal/process/task_queues:83:21) { _api: OvhApi { _events: [Object: null prototype] {}, _eventsCount: 0, _maxListeners: undefined, updatingCert: null, updatingCertResolve: null, queryCache: null, data: { appKey: 'xxxxxx', appSecret: 'xxxxxx', consumerKey: 'xxxxxx', timeout: 180000, host: 'eu.api.ovh.com', port: 443, accessRules: [Array], apiTimeDiff: 0, certCacheFile: '', nichandle: '', retrySleep: 100, maxRetry: 10, saveQuerys: false, launchBrower: true, certMonitorProvider: [Function: stdOutCertMonitorProvider], slotClass: undefined, endpoint: 'ovh-eu', keepUnexpectedCredential: false, redirectUrl: 'https://www.ovhcloud.com/' }, querySet: null, basePath: '/1.0',

}, method: 'GET', path: '/me', errorCode: 'HTTP_ERROR', httpCode: '403 Forbidden' }

UrielCh commented 11 months ago

I do not have any OVH US Account, so I can not test it.

verylys commented 11 months ago

Hello Uriel, No need to have an account:

image

This is just not normal. Host should be api.us.ovhcloud.com when the tool is called with "--api us" parameter

verylys commented 10 months ago

Up :) @UrielCh would love to see a fix for that 🙏🏻🙏🏻

UrielCh commented 10 months ago

mmmm....

ok

UrielCh commented 10 months ago

issue localized.

UrielCh commented 10 months ago

Hi,

Quick note: ovh-bill-importer v1.2.0 is out and the new certificate error message confirms it's working as intended (yay for debugging!). Can you give it a once-over?

Also, I'm back in Europe job-hunting after my last company closed. If you know of any leads, especially with OVH-related projects, I'm on the lookout.

Thanks!

verylys commented 10 months ago

Well thank you ! 2023-06-12_INV_US565926_18.24USD.pdf

The connection to the US api is now fine, the invoice are listed/downloaded. BuT the invoice content (pdf files) is wrong. They all contain the same thing, a HTML code (see attachment).

UrielCh commented 8 months ago

arf the pdf file contains an HTML page....

I need a response from the OVH API to debug that, but that may be an OVH issue.