Code Monkey home page Code Monkey logo

Comments (10)

joaquin-gimenez avatar joaquin-gimenez commented on August 25, 2024

@roryhewitt The library does not read the first 4 lines, it looks for 'client_token', 'client_secret', 'access_token' and 'host' from the object (containing all other configurations as well and regardless of any order). It might have been a syntax error on the new lines added. If you can reproduce the issue please attach a screen with the error message. Let me know if this helped.
Cheers

from akamaiopen-edgegrid-node.

roryhewitt avatar roryhewitt commented on August 25, 2024

Hey @joaquin-gimenez here you go...

image

The first request had my .edgerc file as follows:

[image-manager]
client_secret = fOW...
host = akab-2i2...
access_token = akab-lxw...
client_token = akab-c3c...

and it worked successfully.

Then, I added a 'client_description' value, tried again, and I got the failure.

[image-manager]
client_description = Rory Hewitt
client_secret = fOW...
host = akab-2i2...
access_token = akab-lxw...
client_token = akab-c3c...

Finally, I added the comment after the other 4 lines, and it worked again:

[image-manager]
client_secret = fOW...
host = akab-2i2...
access_token = akab-lxw...
client_token = akab-c3c...
client_description = Rory Hewitt

The fact that it worked when I added the comment after the four 'real' ;lines is what leads me to believe that some where it's only checking the first 4 lines. But obviously I could be wrong :)

from akamaiopen-edgegrid-node.

roryhewitt avatar roryhewitt commented on August 25, 2024

Here are the commands in the screenshot as copy/paste text:

ERROR:
         TypeError: Cannot read property 'replace' of null
    at Object.dataToSign (C:\Users\rhewitt\.akamai-cli\src\cli-auth\node_modules\edgegrid\src\helpers.js:72:28)
    at Object.signRequest (C:\Users\rhewitt\.akamai-cli\src\cli-auth\node_modules\edgegrid\src\helpers.js:144:39)
    at makeAuthHeader (C:\Users\rhewitt\.akamai-cli\src\cli-auth\node_modules\edgegrid\src\auth.js:40:58)
    at Object.generateAuth (C:\Users\rhewitt\.akamai-cli\src\cli-auth\node_modules\edgegrid\src\auth.js:65:37)
    at EdgeGrid.auth (C:\Users\rhewitt\.akamai-cli\src\cli-auth\node_modules\edgegrid\src\api.js:60:23)
    at Promise (C:\Users\rhewitt\.akamai-cli\src\cli-auth\src\egauth.js:91:24)
    at new Promise (<anonymous>)
    at edgeGridAuth.verify (C:\Users\rhewitt\.akamai-cli\src\cli-auth\src\egauth.js:86:16)
    at verify (C:\Users\rhewitt\.akamai-cli\src\cli-auth\bin\akamaiAuth:44:14)
    at TypeCommand.run [as _runHandler] (C:\Users\rhewitt\.akamai-cli\src\cli-auth\bin\akamaiAuth:81:20)

from akamaiopen-edgegrid-node.

roryhewitt avatar roryhewitt commented on August 25, 2024

OK, I suspect the problem is in edgerc.js (part of edgegrid):

function validatedConfig(config) {

  if (!(config.host && config.access_token &&
        config.client_secret && config.client_token)) {
          var errorMessage = "";
          var tokens = 
            ['client_token', 'client_secret','access_token','host'];
          tokens.forEach(function(token) {
            if (!config[token]) {
              errorMessage += "\nMissing: " + token;
            }
          })
          console.log('Missing part of the configuration:\n' + errorMessage);
          return {};
        }

  if (config.host.indexOf('https://') > -1) {
    return config;
  }

  config.host = 'https://' + config.host;
      
  return config;
}

That tokens.forEach will fail, since it's only going to run 4 times (once per token). So if there are any lines which come before any of those tokens, it'll miss them.

from akamaiopen-edgegrid-node.

joaquin-gimenez avatar joaquin-gimenez commented on August 25, 2024

@roryhewitt thanks for the details, i'll have a look

from akamaiopen-edgegrid-node.

 avatar commented on August 25, 2024

Joaquin, what's the blocker on this one?

Kirsten

from akamaiopen-edgegrid-node.

joaquin-gimenez avatar joaquin-gimenez commented on August 25, 2024

@synedra this was a bug that was fixed previously, but as cli-auth didn't have the latest edgegrid version, it was not running the fix. I've updated the edgegrid version on cli-auth and with it if you update akamai the issue is fixed
https://github.com/akamai/cli-auth/pull/11

from akamaiopen-edgegrid-node.

piotrpio avatar piotrpio commented on August 25, 2024

Hello @roryhewitt
This bug seems to have been fixed for this package in version 3.0.5. Can you confirm whether we can close the issue?

Thanks

from akamaiopen-edgegrid-node.

roryhewitt avatar roryhewitt commented on August 25, 2024

@piotrpio Well the code itself looks basically the same, but on running the package, the problem appears to have resolved itself. Let's go ahead and close it -it can always be reopened if it pops back up :)

from akamaiopen-edgegrid-node.

piotrpio avatar piotrpio commented on August 25, 2024

Thanks for letting me know, I'm closing the issue then :)

from akamaiopen-edgegrid-node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.