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

Auth0 Mock Server Example, This Repo Not Testing? #289

Open
AE1020 opened this issue Dec 26, 2024 · 2 comments
Open

Auth0 Mock Server Example, This Repo Not Testing? #289

AE1020 opened this issue Dec 26, 2024 · 2 comments

Comments

@AE1020
Copy link

AE1020 commented Dec 26, 2024

Hello, I don't know much Node.js, but I wanted a mock Auth0 server. I found this article:

https://frontside.com/blog/2022-01-13-auth0-simulator/

That seemed very much like what I wanted. But this is apparently outdated, so I tried to follow the current example, which is unfortunately in TypeScript and uses things like "Effect" which I am even less aware of than Node.

When I tried it, there is a top-level error regarding the type signature:

Argument of type '() => Generator<Promise | Resource | Promise<Scenario> | undefined, void, Server>' is not assignable to parameter of type '(args: string[]) => Operation'.
Call signature return types 'Generator<Promise | Resource | Promise<Scenario> | undefined, void, Server>' and 'Operation' are incompatible.

It appears to not like passing main() something that yields the result of createSimulationServer()

I eyeballed the auth0 tests in this repository, and they seemed to use that syntax of the example.

So I figured I'd start from the tests in this repo and pare things down to see where the example case deviated such as to be broken, except... the tests for auth0 (and other things) were disabled

I tried reverting to the commit prior to that disabling and doing npm test but it seems there's other entanglements.

Would it be possible to get a turnkey example with the current code for someone who would like to use the auth0 server (perhaps suitable even for someone who doesn't generally know where to start in setting up a TypeScript project, either by providing all the necessary files and settings as a complete example, or giving the example as plain JavaScript?)

@AE1020 AE1020 changed the title Can't get Auth0 Mock Server Example Working, This Repo Not Testing? Auth0 Mock Server Example, This Repo Not Testing? Dec 26, 2024
@AE1020
Copy link
Author

AE1020 commented Dec 26, 2024

While I still can't get the auth0 server example code to work (hangs in the client creation and never gets to the part that creates a user), I did figure out the particular error above. It seems the current version of the "Effection" library has changed from the one used in the simulacrum source.

Problem discovered with: npm ls effection

├─┬ @simulacrum/[email protected]
│ ├─┬ @effection/[email protected]
│ │ └── [email protected]
│ └─┬ [email protected]
│   └─┬ @effection/[email protected]
│     └─┬ @effection/[email protected]
│       └── [email protected]
├─┬ @simulacrum/[email protected]
│ └── [email protected]
├─┬ @simulacrum/[email protected]
│ ├─┬ @effection/[email protected]
│ │ └── [email protected]
│ └── [email protected]
└── [email protected]   # <-- problem

I remedied this with requesting explicitly [email protected] in the package.json

Could the documentation/articles be updated with a brief explanation of what's going on, and what the plans are? This still comes up as an early Google hit for mock auth0 server, and seems to be one of the most complete ones. It would be nice if there were a demonstrated working deployment in GitHub Actions showing the auth0 mock server being used successfully.

I'd also like to not need to create an https certificate, if that's possible to make an option--as part of the value of a mock server is getting a hassle-free way to test. https is hardcoded here:

let server = yield createServer(app, { protocol: 'https', port });

@taras
Copy link
Member

taras commented Dec 27, 2024

Hi @AE1020, the team is currently on holidays. We won't be able to respond to these messages until we return - after Jan 6th. Sorry for the trouble.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants