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

ESLINT error: TypeError: (0 , import_module.createRequire) is not a function at open_api.js:4: #5171

Open
nezlicodes opened this issue Jul 15, 2023 · 0 comments
Labels
type: bug code to address defects in shipped code

Comments

@nezlicodes
Copy link

Describe the bug

I'm using the package to create sites programmatically from a nuxt.js app and I'm getting this error:
TypeError: (0 , import_module.createRequire) is not a function at open_api.js:4:

package versions:
nuxt: 3.6.3
eslint: 8.38.0
netlify: 13.1.10
nvm current: v20.3.1

Can you please provide help with this?

Steps to reproduce

  1. Create Nuxt app.
  2. install npm packages.
  3. Call functions from the utils/netlify file:
import { NetlifyAPI } from "netlify";

const config = useRuntimeConfig();
const api = new NetlifyAPI(config.public.netlify_auth_token);
const client = useSupabaseAuthClient();

export async function createSite(githubUser,siteName: string, repoName: string) {
  await api
    .createSite({
      account_slug: "githubUser",
      body: {
        name: siteName,
        ssl: true,
        repo: {
          provider: "github",
          repo: `${githubUser}/${repoName}`,
          private: true,
          branch: "main",
          cmd: "CI= npm run generate",
          installation_id: config.installation_id,
          dir: "/dist",
        },
        custom_domain: custom_domain.com,
      },
    })
    .then(async (res: any) => {
      await client.auth.updateUser({
        data: { site_id: res.site_id, deployed: true },
      });
      return res;
    })
    .catch(async (err: any) => {
      await client.auth.updateUser({ data: { deployed: false } });
      return err;
    });
}

export async function getSite(siteId: string) {
  return await api
    .getSite({
      site_id: siteId,
    })
    .then((res: any) => {
      return res;
    })
    .catch((err: any) => {
      return err;
    });
}

Configuration

No response

Deploy logs

Can not create a deploy.

@nezlicodes nezlicodes added the type: bug code to address defects in shipped code label Jul 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

1 participant