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

Absolute manifest path cannot be used to initialize a simnet session on Windows #1634

Open
BowTiedRadone opened this issue Dec 23, 2024 · 4 comments
Assignees

Comments

@BowTiedRadone
Copy link

BowTiedRadone commented Dec 23, 2024

Describe the bug
An unexpected error is thrown while attempting to initialize the simnet using an absolute manifest path on Windows. The error message is "unable to mutate url".

To Reproduce
Steps to reproduce the behavior:

  1. On a Windows machine, create a minimal Node.js app having the following index.js:
import { initSimnet } from "@hirosystems/clarinet-sdk";
import { resolve } from "path";

const main = async () => {
  const manifestDir = process.argv[2];

  const manifestPath = resolve(manifestDir, "Clarinet.toml");

  console.log(manifestPath);
  await initSimnet(manifestPath);
};

main();
  1. Add a Clarinet project called example at the root of the node app.
  2. Run index.js using the following command:
node index.js example
  1. See error:
$ node index.js example
C:\Users\...\bug-demo\example\Clarinet.toml
node:internal/process/promises:389
      new UnhandledPromiseRejection(reason);
      ^

UnhandledPromiseRejection: This error originated either by throwing inside of an
 async function without a catch block, or by rejecting a promise which was not h
andled with .catch(). The promise rejected with the reason "unable to mutate url
".
    at throwUnhandledRejectionsMode (node:internal/process/promises:389:7)
    at processPromiseRejections (node:internal/process/promises:470:17)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:3
2) {
  code: 'ERR_UNHANDLED_REJECTION'
}

Node.js v20.18.1

Environment (please complete the following information):

  • OS: Windows

Additional Context
The same setup works on Linux and macOS.

@github-project-automation github-project-automation bot moved this to 🆕 New in DevTools Dec 23, 2024
BowTiedRadone added a commit to stacks-network/rendezvous that referenced this issue Dec 28, 2024
This commit removes `windows-latest` from the `os` matrix. Until a fix for
hirosystems/clarinet#1634, `npm test` will fail on Windows.
BowTiedRadone added a commit to stacks-network/rendezvous that referenced this issue Dec 28, 2024
This commit separates the jobs for running regular tests and example tests.
Example tests are now included for Windows, increasing coverage until
hirosystems/clarinet#1634 is resolved.
BowTiedRadone added a commit to stacks-network/rendezvous that referenced this issue Dec 28, 2024
This commit separates the jobs for running regular tests and example tests.
Example tests are now included for Windows, increasing coverage until
hirosystems/clarinet#1634 is resolved.
moodmosaic pushed a commit to stacks-network/rendezvous that referenced this issue Dec 28, 2024
This commit removes `windows-latest` from the `os` matrix. Until a fix for
hirosystems/clarinet#1634, `npm test` will fail on Windows.
moodmosaic pushed a commit to stacks-network/rendezvous that referenced this issue Dec 28, 2024
This commit separates the jobs for running regular tests and example tests.
Example tests are now included for Windows, increasing coverage until
hirosystems/clarinet#1634 is resolved.
@hugocaillard
Copy link
Collaborator

Hey @BowTiedRadone, seeing this C:\Users\...\bug-demo\example\Clarinet.toml, isn't this path invalid?

C:\Users\.. is C:\
C:Users\... seems to va invalid to me.

I think this is the issue.
Also, looking in details to this, I actually realise that initSimnet takes the relative path to the current working directory.
So you need to do path.join(dir, "Clarinet.toml") (join instead of resolve)

Finally, if you want to follow a more "clarinet-like" CLI, we usually take the full path to the manifest, as in

$ clarinet check --manifest-path path/to/Clarinet.toml
# or
$ clarinet check --m path/to/Clarinet.toml

Allowing, not only to have a custom directory but also to have manifest file name (and multiple of them), as in Clarinet_v1.toml, Clarinet_v2.toml, etc

@BowTiedRadone
Copy link
Author

Hi @hugocaillard! Sorry for the misunderstanding. Yes, the ... was added to not specify the full path on my machine. The full output is:

$ node index.js example
C:\Users\radub\bug-demo\example\Clarinet.toml
(node:21512) [DEP0040] DeprecationWarning: The `punycode` module is deprecated.
Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
node:internal/process/promises:392
      new UnhandledPromiseRejection(reason);
      ^

UnhandledPromiseRejection: This error originated either by throwing inside of an
 async function without a catch block, or by rejecting a promise which was not h
andled with .catch(). The promise rejected with the reason "unable to mutate url
".
    at throwUnhandledRejectionsMode (node:internal/process/promises:392:7)
    at processPromiseRejections (node:internal/process/promises:475:17)
    at process.processTicksAndRejections (node:internal/process/task_queues:106:
32) {
  code: 'ERR_UNHANDLED_REJECTION'
}

Node.js v22.12.0

@hugocaillard
Copy link
Collaborator

Ok got, will keep investigating then 😅

@BowTiedRadone
Copy link
Author

Thank you! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
3 participants