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

NetlifyAPI on Dev (local): The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received undefined #4793

Closed
well-made-uk opened this issue Dec 26, 2022 · 2 comments
Labels
stale type: bug code to address defects in shipped code

Comments

@well-made-uk
Copy link

well-made-uk commented Dec 26, 2022

Describe the bug

I'm using NetlifyAPI exactly as described on a Netlify Function (testing locally with Netlify Dev):

#index.mjs

import { NetlifyAPI } from 'netlify'

async function getSites() {
  const client = new NetlifyAPI('******')
  const sites = await client.listSites()
}

console.log(getSites())

This is only a completely fresh project (no config etc).

Here's the error I got:

new NodeError (node:internal/errors:393:5)
createRequire (node:internal/modules/cjs/loader:1278:11)
Object. (***/netlify/functions/sites/node_modules/netlify/lib/open_api.js:4:17)
Module._compile (node:internal/modules/cjs/loader:1159:14)
Object.Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
Module.load (node:internal/modules/cjs/loader:1037:32)
Function.Module._load (node:internal/modules/cjs/loader:878:12)
Module.require (node:internal/modules/cjs/loader:1061:19)
require (node:internal/modules/cjs/helpers:103:18)
Object. (/***/.netlify/functions-serve/sites/sites.js:1:18)

Steps to reproduce

I can't share my repo (API key in there), but it's only 1 file.

Configuration

No response

Deploy logs

Local only.

new NodeError (node:internal/errors:393:5) createRequire (node:internal/modules/cjs/loader:1278:11) Object. (***/netlify/functions/sites/node_modules/netlify/lib/open_api.js:4:17) Module._compile (node:internal/modules/cjs/loader:1159:14) Object.Module._extensions..js (node:internal/modules/cjs/loader:1213:10) Module.load (node:internal/modules/cjs/loader:1037:32) Function.Module._load (node:internal/modules/cjs/loader:878:12) Module.require (node:internal/modules/cjs/loader:1061:19) require (node:internal/modules/cjs/helpers:103:18) Object. (/***/.netlify/functions-serve/sites/sites.js:1:18)

@well-made-uk well-made-uk added the type: bug code to address defects in shipped code label Dec 26, 2022
Copy link
Contributor

This issue has been automatically marked as stale because it has not had activity in 1 year. It will be closed in 14 days if no further activity occurs. Thanks!

@github-actions github-actions bot added the stale label Dec 27, 2023
Copy link
Contributor

This issue was closed because it had no activity for over 1 year.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

1 participant