Hey,
Is this issue related to version incompatibility!
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol ‘c:’
at new NodeError (node:internal/errors:400:5)
at throwIfUnsupportedURLScheme (node:internal/modules/esm/resolve:1055:11)
at defaultResolve (node:internal/modules/esm/resolve:1135:3)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:842:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
at ESMLoader.import (node:internal/modules/esm/loader:525:22)
at importModuleDynamically (node:internal/modules/esm/translators:110:35)
at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14)
at loadActualModule (file:///C:/Users/Admin/AppData/Roaming/npm/node_modules/@openfn/cli/node_modules/@openfn/runtime/dist/index.js:246:7) {
code: ‘ERR_UNSUPPORTED_ESM_URL_SCHEME’
}
C:\Users\Admin\OpenFnProjects\OpenFnCLI>openfn hello.js -ia http
[CLI] √ Installing packages…
[CLI] √ Installation complete in 5.534s
[CLI] Error loading state from ./state.json
[CLI] [Error: ENOENT: no such file or directory, open ‘C:\Users\Admin\OpenFnProjects\OpenFnCLI\state.json’] {
errno: -4058,
code: ‘ENOENT’,
syscall: ‘open’,
path: ‘C:\Users\Admin\OpenFnProjects\OpenFnCLI\state.json’
}
[CLI] Using default state { data: {}, configuration: {}
[CLI] × Failed to load adaptor typedefs from path C:\tmp\openfn\repo\node_modules@openfn\language-http_4.2.3
[CLI] × Error: Failed getting file at: C:\tmp\openfn\repo\node_modules@openfn\language-http_4.2.3/package.json got: 400 Bad Request
at fetchFile (file:///C:/Users/Admin/AppData/Roaming/npm/node_modules/@openfn/cli/node_modules/@openfn/describe-package/dist/index.js:380:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async preloadAdaptorExports (file:///C:/Users/Admin/AppData/Roaming/npm/node_modules/@openfn/cli/node_modules/@openfn/compiler/dist/index.js:284:20)
at async loadTransformOptions (file:///C:/Users/Admin/AppData/Roaming/npm/node_modules/@openfn/cli/dist/process/runner.js:235:19)
at async compile_default (file:///C:/Users/Admin/AppData/Roaming/npm/node_modules/@openfn/cli/dist/process/runner.js:193:30)
at async executeHandler (file:///C:/Users/Admin/AppData/Roaming/npm/node_modules/@openfn/cli/dist/process/runner.js:389:16)
[CLI] √ Compiled job from hello.js
node:internal/errors:491
ErrorCaptureStackTrace(err);
^
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol ‘c:’
at new NodeError (node:internal/errors:400:5)
at throwIfUnsupportedURLScheme (node:internal/modules/esm/resolve:1055:11)
at defaultResolve (node:internal/modules/esm/resolve:1135:3)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:842:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
at ESMLoader.import (node:internal/modules/esm/loader:525:22)
at importModuleDynamically (node:internal/modules/esm/translators:110:35)
at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14)
at loadActualModule (file:///C:/Users/Admin/AppData/Roaming/npm/node_modules/@openfn/cli/node_modules/@openfn/runtime/dist/index.js:246:7) {
code: ‘ERR_UNSUPPORTED_ESM_URL_SCHEME’
}
See the following information to get details of the environment. I am using Windows 10
openfn test
[CLI] i Versions:
▸ Node.js 18.0.0
▸ cli 0.0.25
▸ runtime 0.0.15
▸ compiler 0.0.22
[CLI] i Running test job…
[CLI] No state detected: pass -S to provide some state
[CLI] √ Compiled job from const fn = () => state => state * 2; fn()
[CLI] i Compiled job:
const fn = () => state => state * 2;
export default [fn()];
[CLI] i Running job…
[R/T] √ Operation 1 complete in 0ms
[CLI] √ Result: 42
Interesting! And what’s in that hello.js file that causes the error? (And… sorry for the simple questions… is that the correct path or do you need some sort of ./hello.js ? Sorry, I’m no good at the Windows command line.)
PS C:\Users\Admin\OpenFnProjects\OpenFnCLI> openfn .\hello.js -ia http
[CLI] Installing packages…
[CLI] Installation complete in 13.191s
[CLI] Error loading state from ./state.json
[CLI] [Error: ENOENT: no such file or directory, open ‘C:\Users\Admin\OpenFnProjects\OpenFnCLI\state.json’] {
errno: -4058,
code: ‘ENOENT’,
syscall: ‘open’,
path: ‘C:\Users\Admin\OpenFnProjects\OpenFnCLI\state.json’
}
[CLI] Using default state { data: {}, configuration: {}
[CLI] ✘ Failed to load adaptor typedefs from path C:\tmp\openfn\repo\node_modules@openfn\language-http_4.2.3
[CLI] ✘ Error: Failed getting file at: C:\tmp\openfn\repo\node_modules@openfn\language-http_4.2.3/package.json got: 400 Bad Request at fetchFile (file:///C:/Users/Admin/AppData/Roaming/npm/node_modules/@openfn/cli/node_modules/@openfn/describe-package/dist/index.js:380:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async preloadAdaptorExports (file:///C:/Users/Admin/AppData/Roaming/npm/node_modules/@openfn/cli/node_modules/@openfn/compiler/dist/index.js:284:20)
at async loadTransformOptions (file:///C:/Users/Admin/AppData/Roaming/npm/node_modules/@openfn/cli/dist/process/runner.js:235:19)
at async compile_default (file:///C:/Users/Admin/AppData/Roaming/npm/node_modules/@openfn/cli/dist/process/runner.js:193:30)
at async executeHandler (file:///C:/Users/Admin/AppData/Roaming/npm/node_modules/@openfn/cli/dist/process/runner.js:389:16)
[CLI] Compiled job from .\hello.js
node:internal/errors:491
ErrorCaptureStackTrace(err);
^
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data are supported by the default ESM loader. On Windows,
absolute paths must be valid file:// URLs. Received protocol ‘c:’
at new NodeError (node:internal/errors:400:5)
at throwIfUnsupportedURLScheme (node:internal/modules/esm/resolve:1055:11)
at defaultResolve (node:internal/modules/esm/resolve:1135:3)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:842:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
at ESMLoader.import (node:internal/modules/esm/loader:525:22)
at importModuleDynamically (node:internal/modules/esm/translators:110:35)
at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14)
at loadActualModule (file:///C:/Users/Admin/AppData/Roaming/npm/node_modules/@openfn/cli/node_modules/@openfn/runtime/dist/index.js:246:7) {
code: ‘ERR_UNSUPPORTED_ESM_URL_SCHEME’
}
Hey @haftamuk , I’ve run into the same issue. Sit tight while we come up with a Windows workaround. Back in a flash. (Right now thinking about building adaptors locally for windows and passing the path, rather than using that “auto-install” feature in the CLI.)
Just testing now but local builds on Windows will probably have path related issues—all of our testing has been on Linux… ubuntu and mac mostly.
@haftamuk , of the group that was meant to do the challenge, what percent do you think are using Windows? Wondering if we should delay the training by a couple of days. If you’ve run into this Windows bug now and they’re also using Windows, I think it’s safe to assume that they haven’t completed the pre-requisites. What do you think? Feel free to give me a buzz if you’d rather chat on the phone.
@jclark has just fixed this and you can update to v0.0.26 for windows support. We should still touch base tomorrow morning about whether or not you’d like to go forward with the training… I think it would be much better to ensure that everyone had completed (and provided feedback/edits to) the getting-started/developer-challenge. Thoughts?
hello openFn,
once I have completed the mapping of incoming source data(.json) file to DHIS2 destination system how I can sync (post) the mapped formatted .json file. I know already have create method in DHIS2 built in adaptors that accepts the resource, data with optional parameters and callback function. however my question is can I create another state.json file to store the data and credentials for DHIS2. thanks…
Hello mtuchi,
thanx so much for you ur attention and quick response, how i can win up the data from source system into dhis2 data key and how i can assign the path of array during using of “each” method.