Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't insert document using cloudflare workers #107

Open
4 tasks done
OultimoCoder opened this issue May 9, 2022 · 1 comment
Open
4 tasks done

Can't insert document using cloudflare workers #107

OultimoCoder opened this issue May 9, 2022 · 1 comment

Comments

@OultimoCoder
Copy link

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed
  • I'm reporting the issue to the correct repository (for multi-repository projects)

Issue Description

Using cloudflare workers I create a client and try to insert a document but everytime I do I get this error:

{
  request: Promise {
    undefined,
    [Symbol(async_id_symbol)]: 556,
    [Symbol(trigger_async_id_symbol)]: 555,
    [Symbol(kResourceStore)]: RequestContext {
      requestDepth: 1,
      pipelineDepth: 1,
      durableObject: false
    }
  }
}

If I resolve the request it just resolves to undefined.

This is literally all I am doing:

import jsc8 from 'jsc8';
const macroClient = new jsc8({
  url: ['https://gdn1.macrometa.io', 'https://gdn2.macrometa.io'],
  apiKey: MACROMETA_SECRET_KEY,
  fabricName: '_system',
  agent: fetch
});

const createUser = async (userBody) => {
  let res;
  try {
    res = await macroClient.insertDocument('users', userBody)
  } catch(err) {
    console.log(err)
  }
  return res
};

Example user body:

{
  email: 'user@gmail.com',
  password: 'iphone234',
  role: 'user',
  name: 'iamauser'
}

What am I missing? Why does the error tell me nothing? Same error running locally and with cloudflare.

@astrotars
Copy link

@OultimoCoder API errors surfaced to the SDK generally provide a more verbose error message. It's hard to tell what's going on with the error message you've provided. What version of Node are you running? Can you provide the full code so I can see how you're calling the createUser function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants