Giter VIP home page Giter VIP logo

hyper-aws4's People

Contributors

tim-zhang avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

hyper-aws4's Issues

401 Unauthorised on some requests

Hi Tim,

I'm getting 401 responses on some requests. The below sample code taken from the example here, so it should work.

Any assistance to diagnose / resolve this would be appreciated.

-Nick

var aws4 = require('hyper-aws4')
var fetch = require('node-fetch')
 
var body = {"NetworkConfigs": {}, "ServiceConfigs": { "M": { "db": { "environment": [ "MYSQL_ROOT_PASSWORD=my-secret-pw" ], "external_links": null, "image": "mysql:latest" }, "web": { "depends_on": [ "db" ], "external_links": null, "image": "wordpress:latest", "links": [ "db:mysql" ] } } }, "VolumeConfigs": {} } ;
var body_string = JSON.stringify(body);

var signOption = {
  url: 'https://us-west-1.hyper.sh/compose/up?project=blog',
  body: body_string,
  method: 'POST',
  credential: {
    accessKey: '<REPLACE_ACCESS_KEY>',
    secretKey: '<REPLACE_SECRET_KEY>'
  }
}
 
var headers = aws4.sign(signOption)

fetch(signOption.url, {method: signOption.method, headers: headers}).then(function(res) {
    return res;
}).then(function(res) {
    console.log(res.status + " " + res.statusText);
});

TypeError: _crypto2.default.createHash is not a function

I am trying to use it on my Angular app.

import * as aws4 from 'hyper-aws4';

test() {
    const creds = this.awsService.getFederateIdentityCredentials();
    const signOption = {
        url: 'http://google.com',
        credential: {
          accessKey: creds.accessKeyId,
          secretKey: creds.secretAccessKey
        }
      }
    const headers = aws4.sign(signOption);
    console.log(headers);
}

but I get this error:

TypeError: _crypto2.default.createHash is not a function

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.