fungible-systems / micro-stacks

Tiny libraries for building the next generation of Stacks apps.
https://micro-stacks.dev
MIT License
82 stars 15 forks source link

lookupProfile throwing an error but working in stacks.js #177

Closed pradel closed 1 year ago

pradel commented 1 year ago

Hey found an issue that started to pop in the last weeks but didn't see it was related to micro-stacks at first. For information the same code is working fine with stacks.js. Not sure if it could be related to an API change for stacks 2.1? We are using micro-stacks in Sigle server-side and found this issue which makes us unable to resolve some usernames to the gaia config.

Error: TypeError: Failed to parse URL from https://.

Reproducing example

https://codesandbox.io/p/sandbox/quiet-frog-rb4gqp?file=%2Findex.js&selection=%5B%7B%22endColumn%22%3A1%2C%22endLineNumber%22%3A13%2C%22startColumn%22%3A1%2C%22startLineNumber%22%3A13%7D%5D

const { lookupProfile: stacksLookupProfile } = require("@stacks/auth");
const { lookupProfile: microLookupProfile } = require("micro-stacks/storage");

const run = async () => {
  const data = await stacksLookupProfile({ username: "sigle.btc" });
 // Working fine
  console.log(data);

  const data2 = await microLookupProfile({ username: "sigle.btc" });
// throwing an error but should work fine
  console.log(data2);
};

run();
pradel commented 1 year ago

Pr fixing the issue https://github.com/fungible-systems/micro-stacks/pull/178