question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Authorizer is not exported

See original GitHub issue

So, I just updated my Casbin.js version from 0.4.0 to 1.0.1 and I’ve run into the following error:

TS2305: Module '"/node_modules/casbin.js/lib"' has no exported member 'Authorizer'.

It seems that the Authorizer class is not being exported anymore. I looked into the docs (here in Github and in the Casbin website), and both still cites the Authorizer on how to use the lib.

Was the Authorizer removal by design or is this a bug?

Steps to reproduce the error

  1. Simply install any version of Casbin after the version 0.4.0;
  2. Try to import Authorizer, as noted in the docs:
	import { Authorizer } from 'casbin.js';

or

	import * as casbinjs from 'casbin.js';

	const authorizer = new casbinjs.Authorizer("manual")

Environment

I was able to reproduce this error in two different scenarios:

  1. Using React with CRA
  2. Using React with Vite

This error also persisted from the version 1.0.0-beta.1, from what I tested.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
hsluoyzcommented, Mar 26, 2022

@armr-dev @GhostyJade Casbin.js v1.x has been deprecated, please use latest v0.4.1 instead: https://github.com/casbin/casbin.js/releases/tag/v0.4.1

0reactions
armr-devcommented, Mar 28, 2022

This solved the issue. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

API Gateway not importing exported definition - Stack Overflow
The error(s) that I get when importing a definition I had just exported are: Your API was not imported due to errors in...
Read more >
Output from an Amazon API Gateway Lambda authorizer
A Lambda authorizer function's output is a dictionary-like object, which must include the principal identifier ( principalId ) and a policy document ...
Read more >
Importing/Exporting Serverless Custom Authorizers Across ...
Now we have our BasicAuthorizer being exported, we can import it into our other stacks using the magic of the Intrinsic CloudFormation function ......
Read more >
Question: Custom Authorizers · Issue #169 - GitHub
We are working on adding custom authorizer support for Swagger import and export, but this has not been released yet.
Read more >
Import export doesn't work when authorization is activated
When you export, it exports fine. When you import, no such luck, because script upload is disabled. So, exception. My problem with this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found