question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The 'credentials' field on 'RequestInitializerDict' is not implemented

See original GitHub issue

Hi, trying to use mailgun-js in Cloudflare Workers. This returns The 'credentials' field on 'RequestInitializerDict' is not implemented.

  try {
    await mailgun.client({
      username: 'api',
      key: MAILGUN_APIKEY,
      timeout: 10000,
    })
    .messages.create(MAILGUN_DOMAIN, {
      from: 'Website Contact <website@' + MAILGUN_DOMAIN + '>',
      to: EMAIL_TO,
      subject: 'Contact Form: ' + body.subject,
      text: body.email + '\n' + body.message,
    });
  } catch (e) {
    console.error(e);
  }

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
ColdSaucecommented, Dec 13, 2021

After trying to hack together a solution with the library by calling internal functions, I ended up getting an openssl error due to cloudflare workers using node version 17 which wasn’t compatible with some crypto stuff mailgun uses.

Decided to say screw it and just called the API directly like you 😆 if it works it works I guess!

2reactions
hazcodcommented, Dec 13, 2021

@ColdSauce I just wrote a raw API call to mailgun: https://github.com/iron-security/website/blob/main/workers/index.js#L113 I was a bit disappointed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The `credentials` field on `RequestInitializerDict` is not ...
I am experiencing the same issue with credentials that prevents ky from being used with Cloudflare Workers that redaxios is also ...
Read more >
Fetch() init.cache mode error - Developers
Uncaught (in promise) Error: The 'cache' field on 'RequestInitializerDict' is not implemented. at fetchFromDb (worker.js:22131:26) at ...
Read more >
TypeError: Incorrect type for the 'headers' field on ' ...
Fix with this: let apiRequest = new Object apiRequest.headers = Object.assign(basicHeaders, additionHeaders) apiRequest.body ...
Read more >
ardatan/graphql-tools release-1662389474291 on GitHub
This prevents an error like (The 'credentials' field on 'RequestInitializerDict' is not implemented.) on the environments that don't support ...
Read more >
Throw an error for unimplemented `fetch` options #134
Error: The 'mode' field on 'RequestInitializerDict' is not implemented. at doFetch (worker.js:7:23) at worker.js:2:21. Usually this happens when I'm being ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found