chiefbiiko / dynamodb

deno <3 dynamodb
MIT License
25 stars 11 forks source link

Credential must have exactly 5 slash-delimited elements #13

Closed mbonig closed 4 years ago

mbonig commented 4 years ago

Simple test:

import { createClient } from "https://raw.githubusercontent.com/mbonig/dynamodb/master/mod.ts";

const ddb = createClient({port:443});

const results = await ddb.listTables();

Results in this error:


error: Uncaught Error: Credential must have exactly 5 slash-delimited elements, e.g. keyid/date/region/service/term, got '/'

Note the above code uses a slight modification of this module due to the other issues I've mentioned previously.

mbonig commented 4 years ago

Ok, well I can tell you how I fixed this, but I don't think it's right:

export function createClient(conf?: ClientConfig): DynamoDBClient {
  const _conf: Doc = deriveConfig(conf);
  // added this:
  _conf.cache.refresh();

  const dyno: DynamoDBClient = {} as DynamoDBClient;

  for (const op of OPS) {
    dyno[camelCase(op)] = baseOp.bind(null, _conf, op);
  }

  return dyno;
}

I say this isn't right because A) it doesn't await the refresh, so could be a ticking timebomb B) I'm not convinced this is the right place to do the initial refresh (or maybe the refresh should happen immediately).

chiefbiiko commented 4 years ago

the v0.3.0 release fixes those config and auth errors

mbonig commented 4 years ago

Issue is resolved with v0.3.0