adobe / reactor-uploader

Command line tool for uploading Adobe Experience Platform Tags extensions.
Apache License 2.0
9 stars 11 forks source link

Error retrieving access token. undefined #28

Closed alcazes closed 3 years ago

alcazes commented 4 years ago

I am getting this error when I use the uploader: Error retrieving access token. undefined

Used verbose mode and I get the following:


----------
Authenticating with metascope ent_reactor_extension_developer_sdk
----------
(node:13480) UnhandledPromiseRejectionWarning: Error: Error retrieving access token. undefined
    at module.exports (D:\Users\[username]\AppData\Roaming\npm-cache\_npx\13480\node_modules\@adobe\reactor-uploader\bin\getIntegrationAccessToken.js:113:15)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:13480) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:13480) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
Aaronius commented 4 years ago

Thanks for reporting this @alcazes. It's hard to tell why it's failing in your situation because the error details is undefined. We rely on https://github.com/adobe/jwt-auth for retrieving the access token and I suspect your getting undefined error details due to an issue we reported in that library a while back: https://github.com/adobe/jwt-auth/issues/9

That issue has since been resolved and a new version has been published. I suspect we just need to update the uploader to use the latest version and make a couple adjustments in our code to better align with the adjustments in the jwt-auth library. At that point, hopefully we can get you better information about why the uploader is failing to retrieve an access token on your behalf.

alcazes commented 4 years ago

Thanks @Aaronius for the details. I have tested outside my company network and the reactor-uploader finished with success and I was able to upload the extension to the dev environment.

I think there might e an issue on my company network and I will try to use https://github.com/adobe/jwt-auth to see which error it returns.

Aaronius commented 4 years ago

Fixing the undefined error for users generally is blocked by https://github.com/adobe/jwt-auth/pull/26.

alcazes commented 3 years ago

@Aaronius @thebenrob I think the issue was based on the fact that we have a proxy set on our side and we need to specify the proxy with the credentials to make the uploader work.

It seems proxy option was required on our side with https://username:password@serverproxy:port to be added to requests.

i.e getExtensionPackageFromServer.js

const options = {
    method: 'GET',
    proxy: process.env.proxyServer,
    strictSSL:false,

We also had to modify the code to use jwt-auth We directly copied the js file inside our forked project and changed this parts:

[...]
 return fetch(`${ims}/ims/exchange/jwt/`, postOptions, process.env.proxyServer)

Could both the uploader and jwt-auth be updated to allow proxy to be used ? and we could pass it as command line argument like --proxy ?

alcazes commented 3 years ago

We also had to add process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';

thebenrob commented 3 years ago

@Aaronius, do we know if these changes would have a negative impact on other non-proxy users?

Aaronius commented 3 years ago

The way we would implement it would not have a negative impact on non-proxy users.

alcazes commented 3 years ago

@Aaronius @thebenrob Do we know when the proxy option will be available ?

brenthosie commented 3 years ago

Tracked as PDCL-4946.