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

GenieAuthentication fails to create controller #19

Closed
Sov-trotter opened this issue Aug 2, 2022 · 4 comments
Closed

GenieAuthentication fails to create controller #19

Sov-trotter opened this issue Aug 2, 2022 · 4 comments

Comments

@Sov-trotter
Copy link

Sov-trotter commented Aug 2, 2022

I now understand that the issue GenieFramework/Genie.jl#554 might have been partly caused by GenieAuthenticator.

I followed the steps in the readme. Somehow the modules like Users, AuthenticationController are not loaded into the scope.

ulia> using Genie

julia> Genie.Generator.newapp_mvc("AuthApp")

Please choose the DB backend you want to use: 
1. SQLite
2. MySQL
3. PostgreSQL
4. Skip installing DB support at this time

Input 1, 2, 3 or 4 and press ENTER to confirm.
If you are not sure what to pick, choose 1 (SQLite). It is the simplest option to get you started right away.
You can add support for additional databases anytime later. 

1
  Activating project at `~/.julia/dev`
[ Info: Done! New app created at /home/ezio/.julia/dev/AuthApp
[ Info: Changing active directory to /home/ezio/.julia/dev/AuthApp
    /tmp/jl_Rra9Xl/AuthApp/Project.toml
[ Info: Project.toml has been generated
[ Info: Installing app dependencies
  Activating project at `~/.julia/dev/AuthApp`
  Activating project at `~/.julia/dev/AuthApp`
[ Info: Installing dependencies for unit tests
  Activating new project at `~/.julia/dev/AuthApp/test`
  Activating project at `~/.julia/dev/AuthApp`
  Activating project at `~/.julia/dev/AuthApp`
[ Info: Starting your brand new Genie app - hang tight!
[ Info: Precompiling AuthApp [c510d05b-871a-4c8f-84d0-25ab9f17f1cb]


 ██████╗ ███████╗███╗   ██╗██╗███████╗    ███████╗
██╔════╝ ██╔════╝████╗  ██║██║██╔════╝    ██╔════╝
██║  ███╗█████╗  ██╔██╗ ██║██║█████╗      ███████╗
██║   ██║██╔══╝  ██║╚██╗██║██║██╔══╝      ╚════██║
╚██████╔╝███████╗██║ ╚████║██║███████╗    ███████║
 ╚═════╝ ╚══════╝╚═╝  ╚═══╝╚═╝╚══════╝    ╚══════╝

| Website  https://genieframework.com
| GitHub   https://github.com/genieframework
| Docs     https://genieframework.com/docs
| Discord  https://discord.com/invite/9zyZbD6J7H
| Twitter  https://twitter.com/essenciary

Active env: DEV


Ready! 

┌ Info: 2022-08-02 09:48:31 
└ Web Server starting at http://127.0.0.1:8000 

julia> include(joinpath("config", "initializers", "searchlight.jl"))
SQLite.DB("db/dev.sqlite3")

julia> include(joinpath("config", "initializers", "searchlight.jl"))
SQLite.DB("db/dev.sqlite3")

julia> SearchLight.Migration.init()
┌ Info: 2022-08-02 09:49:16 CREATE TABLE `schema_migrations` (
│       `version` varchar(30) NOT NULL DEFAULT '',
│       PRIMARY KEY (`version`)
└     )
[ Info: 2022-08-02 09:49:16 Created table schema_migrations

(AuthApp) pkg> add GenieAuthentication
   Resolving package versions...
    Updating `~/.julia/dev/AuthApp/Project.toml`
  [e115e502] + GenieAuthentication v2.0.0
    Updating `~/.julia/dev/AuthApp/Manifest.toml`
  [e115e502] + GenieAuthentication v2.0.0
  [07906039] + GeniePlugins v1.0.0
  [03cc5b98] + GenieSession v1.0.0
  [5c4fdc26] + GenieSessionFileSession v1.0.0

julia> using GenieAuthentication

julia> GenieAuthentication.install(@__DIR__)
[ Info: 2022-08-02 09:50:01 Created dir /home/ezio/.julia/dev/AuthApp/app
[ Info: 2022-08-02 09:50:01 Created dir /home/ezio/.julia/dev/AuthApp/app/resources
[ Info: 2022-08-02 09:50:01 Created dir /home/ezio/.julia/dev/AuthApp/app/resources/authentication
[ Info: 2022-08-02 09:50:01 Copied /home/ezio/.julia/packages/GenieAuthentication/4CYFn/files/app/resources/authentication/AuthenticationController.jl to /home/ezio/.julia/dev/AuthApp/app/resources/authentication/AuthenticationController.jl
[ Info: 2022-08-02 09:50:01 Created dir /home/ezio/.julia/dev/AuthApp/app/resources/authentication/views
[ Info: 2022-08-02 09:50:01 Copied /home/ezio/.julia/packages/GenieAuthentication/4CYFn/files/app/resources/authentication/views/login.jl.html to /home/ezio/.julia/dev/AuthApp/app/resources/authentication/views/login.jl.html
[ Info: 2022-08-02 09:50:01 Copied /home/ezio/.julia/packages/GenieAuthentication/4CYFn/files/app/resources/authentication/views/register.jl.html to /home/ezio/.julia/dev/AuthApp/app/resources/authentication/views/register.jl.html
[ Info: 2022-08-02 09:50:01 Copied /home/ezio/.julia/packages/GenieAuthentication/4CYFn/files/app/resources/authentication/views/success.jl.html to /home/ezio/.julia/dev/AuthApp/app/resources/authentication/views/success.jl.html
[ Info: 2022-08-02 09:50:01 Created dir /home/ezio/.julia/dev/AuthApp/app/resources/users
[ Info: 2022-08-02 09:50:01 Copied /home/ezio/.julia/packages/GenieAuthentication/4CYFn/files/app/resources/users/Users.jl to /home/ezio/.julia/dev/AuthApp/app/resources/users/Users.jl
[ Info: 2022-08-02 09:50:01 Copied /home/ezio/.julia/packages/GenieAuthentication/4CYFn/files/app/resources/users/UsersValidator.jl to /home/ezio/.julia/dev/AuthApp/app/resources/users/UsersValidator.jl
[ Info: 2022-08-02 09:50:01 Created dir /home/ezio/.julia/dev/AuthApp/db
[ Info: 2022-08-02 09:50:01 Created dir /home/ezio/.julia/dev/AuthApp/db/migrations
[ Info: 2022-08-02 09:50:01 Copied /home/ezio/.julia/packages/GenieAuthentication/4CYFn/files/db/migrations/2019052410085235_create_table_users.jl to /home/ezio/.julia/dev/AuthApp/db/migrations/2019052410085235_create_table_users.jl
[ Info: 2022-08-02 09:50:01 Created dir /home/ezio/.julia/dev/AuthApp/plugins
[ Info: 2022-08-02 09:50:01 Copied /home/ezio/.julia/packages/GenieAuthentication/4CYFn/files/plugins/genie_authentication.jl to /home/ezio/.julia/dev/AuthApp/plugins/genie_authentication.jl

julia> SearchLight.Migration.up("CreateTableUsers")
[ Info: 2022-08-02 09:50:56 SELECT version FROM schema_migrations ORDER BY version DESC
[ Info: 2022-08-02 09:50:56 CREATE TABLE users (id INTEGER PRIMARY KEY , username TEXT  , password TEXT  , name TEXT  , email TEXT  )
[ Info: 2022-08-02 09:50:56 CREATE  INDEX users__idx_username ON users (username)
[ Info: 2022-08-02 09:50:56 INSERT INTO schema_migrations VALUES ('2019052410085235')
[ Info: 2022-08-02 09:50:56 Executed migration CreateTableUsers up

julia> Genie.Generator.newcontroller("Admin", pluralize = false)
ERROR: ArgumentError: Package AuthApp does not have ViewHelper in its dependencies:
- If you have AuthApp checked out for development and have
  added ViewHelper as a dependency but haven't updated your primary
  environment's manifest file, try `Pkg.resolve()`.
- Otherwise you may need to report an issue with AuthApp
Stacktrace:
 [1] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:980
 [2] top-level scope
   @ ~/.julia/dev/AuthApp/app/resources/authentication/AuthenticationController.jl:6
in expression starting at /home/ezio/.julia/dev/AuthApp/app/resources/authentication/AuthenticationController.jl:6
ERROR: ArgumentError: Package AuthApp does not have UsersValidator in its dependencies:
- If you have AuthApp checked out for development and have
  added UsersValidator as a dependency but haven't updated your primary
  environment's manifest file, try `Pkg.resolve()`.
- Otherwise you may need to report an issue with AuthApp
Stacktrace:
 [1] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:980
 [2] top-level scope
   @ ~/.julia/dev/AuthApp/app/resources/users/Users.jl:3
in expression starting at /home/ezio/.julia/dev/AuthApp/app/resources/users/Users.jl:3
ERROR: ArgumentError: Package AuthApp does not have ViewHelper in its dependencies:
- If you have AuthApp checked out for development and have
  added ViewHelper as a dependency but haven't updated your primary
  environment's manifest file, try `Pkg.resolve()`.
- Otherwise you may need to report an issue with AuthApp
Stacktrace:
 [1] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:980
 [2] top-level scope
   @ ~/.julia/dev/AuthApp/app/resources/authentication/AuthenticationController.jl:6
in expression starting at /home/ezio/.julia/dev/AuthApp/app/resources/authentication/AuthenticationController.jl:6
[ Info: 2022-08-02 09:51:02 New controller created at /home/ezio/.julia/dev/AuthApp/app/resources/admin/AdminController.jl

julia> include(joinpath("plugins", "genie_authentication.jl"))
ERROR: LoadError: ArgumentError: Package AuthenticationController not found in current path:
- Run `import Pkg; Pkg.add("AuthenticationController")` to install the AuthenticationController package.

Stacktrace:
 [1] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:967
 [2] include(fname::String)
   @ Base.MainInclude ./client.jl:451
 [3] top-level scope
   @ REPL[12]:1
in expression starting at /home/ezio/.julia/dev/AuthApp/plugins/genie_authentication.jl:3

cc : @essenciary

@Sov-trotter Sov-trotter changed the title GenieAutheticator fails to create controller GenieAuthentication fails to create controller Aug 2, 2022
@essenciary
Copy link
Member

I think it needs a few more fixes to support Genie 5 - I'll take a look

@Wikunia
Copy link

Wikunia commented Aug 8, 2022

I've tried some more:

  • I've removed the line using ViewHelper

  • ran ] add SHA, GenieSession, GenieSessionFileSession

  • Changed the following import and using statements

    • using Users to using AuthApp.Users in AuthenticationController.jl and in genie_authentication.jl but with import
    • import AuthenticationController to import AuthApp.AuthenticationController in genie_authentication.jl
    • using UsersValidator to using AuthApp.UsersValidator in Users.jl
  • Continued with the rest of this docs: https://genieframework.com/docs/genie/v5/tutorials/4-1--Developing_MVC_Web_Apps.html and started with bin/repl but I get this error:

Loading resources┌ Warning: 2022-08-08 21:47:39 Route named `show_login` is not defined
└ @ Genie.Router ~/.julia/packages/Genie/VkSPs/src/Router.jl:345
┌ Warning: 2022-08-08 21:47:40 Route named `show_login` is not defined
└ @ Genie.Router ~/.julia/packages/Genie/VkSPs/src/Router.jl:345
ERROR: UndefVarError: Users not defined
Stacktrace:
 [1] top-level scope
   @ ~/Code/GenieTests/AuthApp/app/resources/authentication/AuthenticationController.jl:6
in expression starting at /Users/ok/Code/GenieTests/AuthApp/app/resources/authentication/AuthenticationController.jl:6

The resulting repo can be found here: https://github.com/Wikunia/AuthApp.jl

@Wikunia
Copy link

Wikunia commented Aug 8, 2022

With this commit: Wikunia/AuthApp.jl@73da067
I was able to redirect myself to the show login page, login and check that I'm actually logged in. Though I'm still getting the ERROR: UndefVarError: Users not defined error when starting with bin/repl

@essenciary
Copy link
Member

All the issues should now be solved in v2.1.1

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

3 participants