Skip to content

NextJS Error #48

Open
Open
@Mizerness

Description

@Mizerness

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions