ngrok / ngrok-javascript

Embed ngrok secure ingress into your Node.js apps with a single line of code.
https://ngrok.com
Apache License 2.0
86 stars 17 forks source link

Add support for Traffic Policy #114

Closed andrewryno closed 5 months ago

andrewryno commented 5 months ago

Not sure if this is a bug in the upstream lib or not but I wasn't able to get my test working when I only had one of inbound or outbound. It required both, otherwise the builder returns an error:


  ✖ online › policy Rejected promise returned by test
  ─

  online › policy

  __test__/online.spec.mjs:525

   524:   const [httpServer, session] = await makeHttpAndSession();
   525:   const listener = await session.httpEndpoint().policy(policy).listen();
   526:   const response = await forwardValidateShutdown(t, httpServer, listener, listener.url());

  Rejected promise returned by test. Reason:

  Error {
    code: 'GenericFailure',
    message: 'Error parsing policy, failure to parse or generate policy',
  }

  › file://__test__/online.spec.mjs:525:49

  ─

  1 test failed
bobzilladev commented 5 months ago

Probably a bug in rust land, it's set to generate defaults for anything missing, but may have missed something. Will look into.

edit: Yup, in the rename this struct became the parent, but didn't have #[serde(default)]. Adding: https://github.com/ngrok/ngrok-rust/pull/135