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

NextJS Error #48

Open
Mizerness opened this issue Dec 20, 2022 · 0 comments
Open

NextJS Error #48

Mizerness opened this issue Dec 20, 2022 · 0 comments

Comments

@Mizerness
Copy link

Hello,

I hope you are well. I was trying to connect crisp-api to my NextJS project.

However, I got several errors including the fact that it could not find the "dns" package. So I installed it

Here is the code (quite messy but just for testing)

/* Location: lib/c.js */

var Crisp = require("crisp-api");

var CrispClient = new Crisp();

export default CrispClient;
/* Location: components/Crisp/crisp.js */

import { CrispClient } from "../../lib/c.js";

export default function RunCrisp() {
  return (
    <div>
      {test}
    </div>
  );
}

export async function getStaticProps() {
  const identifier = "XXX-XXX-XXXX-XXX";
  const key =
    "XXX-XXX-XXXX-XXX";

  CrispClient.authenticateTier("plugin", identifier, key);

  var test = await CrispClient.website
    .listConversations("XXX-XXX-XXXX-XXX", 1)
    .then(function (conversations) {
      console.log("Listed conversations:", conversations);
    })
    .catch(function (error) {
      console.error("Error listing conversations:", error);
    });

  return {
    props: {
      test,
    },
  };
}
/* Location: pages/testcrisp.js */

import React from "react";
import RunCrisp from "../components/Crisp/crisp.js";

export default function TestCrisp() {
  return (
    <div>
      <RunCrisp />
    </div>
  );
}

And here is the error I have:

Screen Shot 2022-12-20 at 18 29 37

I try to do npm i dns but I just get another error saying that dgram is missing. What I see is that this package is deprecated.

Do you know what can I do to fix this ? Seems that some people using mongo-db package have the same issue.

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

No branches or pull requests

1 participant