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

Can't login to a brand new app unless CORS allowed-origins is modified #1771

Open
mraible opened this issue Jun 4, 2024 · 5 comments
Open

Comments

@mraible
Copy link
Contributor

mraible commented Jun 4, 2024

Describe the bug

If I create a new app with jhipster jdl bug-tracker.jdl --blueprints react-native, I cannot log in because of CORS.

Screenshot 2024-06-03 at 7 14 26 PM

Maybe it's always been this way? If I look at the last tutorial I wrote about it, the origin was http://localhost:19006 and you needed to add it. It seems like we should be able to modify CORS as part of the generation process so people have a better developer experience.

It also doesn't generate any entities in the React Native client.

Screenshot 2024-06-03 at 7 19 09 PM

There are entities generated in the JHipster app.

Screenshot 2024-06-03 at 7 17 13 PM

I noticed this happens with the Ionic blueprint too. I didn't think anything of it when I saw it earlier, but it appears to be a bug.

I also had to run npm install in both generated clients, which doesn't follow the main generator's process of installing everything by default.

Instructions To reproduce

jhipster jdl bug-tracker.jdl --blueprints react-native

If I try with the following (after running npm link in the project):

jhipster jdl bug-tracker.jdl --blueprints react-native --skip-jhipster-dependencies

It get a different error and npm start doesn't work when choosing the w option:

Screenshot 2024-06-03 at 7 28 15 PM

JHipster app's .yo-rc.json

{
  "generator-jhipster": {
    "baseName": "jhipster",
    "blueprints": [
      {
        "name": "generator-jhipster-react-native",
        "version": "4.4.0"
      }
    ],
    "devServerPort": 4200,
    "entities": ["Project", "Label", "Ticket", "Attachment", "Comment"],
    "jhipsterVersion": "8.5.0",
    "jwtSecretKey": "YzcwZjFiY2M3NjAzYTk2YWU2MGJiODQ5NDlhNzc2MmJjYmNmYWVlMzc0NDVmOTEwMThjMTkzYWE0NzkzOGFlZDExZDgxOTY4NTUyNjc5NDY4MzQ2MWRjYjA2OTY3YTJiMmYxMDg0NDkzZTc3MTgwNDg5YzdiNmQ1OTE5NTVhZmY=",
    "languages": ["en"],
    "lastLiquibaseTimestamp": 1717464375000,
    "nativeLanguage": "en",
    "prodDatabaseType": "postgresql",
    "skipJhipsterDependencies": true
  },
  "generator-jhipster-react-native": {
    "appDir": null,
    "reactNativeDir": "../client"
  }
}

Entity JDL or JSON files

entity Project {
  name String
}

entity Label {
  label String required minlength(3)
}

application {
  config {
    prodDatabaseType postgresql,
  }
  entities *
}

entity Ticket {
  title String required
  description String
  dueDate LocalDate
  date ZonedDateTime
  status Status
  type Type
  priority Priority
}

entity Attachment {
  name String required minlength(3)
  file Blob
}

relationship ManyToMany {
  Ticket{label(label)} to Label{ticket}
}

relationship ManyToOne {
  Ticket{project(name)} to Project
  Ticket{assignedTo(login)} to User with builtInEntity
  Ticket{reportedBy(login)} to User with builtInEntity
  Comment{login} to User with builtInEntity
}

relationship OneToMany {
  Comment{parent} to Comment{child}
  Ticket to Attachment 
}

enum Status {
  OPEN("Open")
  WAITING_FOR_RESPONSE("Waiting for Customer Response")
  CLOSED("Closed")
  DUPLICATE("Duplicate")
  IN_PROGRESS("In Progress")
  REOPENED("Reopened")
  CANNOT_REPRODUCE("Cannot Reproduce")
  SOLVED("Solved")
  WONT_IMPLEMENT("Won't Implement")
  VERIFIED("Verified")
  
}

enum Type {
  BUG("Bug"),
  FEATURE("Feature")
}

enum Priority {
  HIGHEST("Highest")
  HIGHER("Higher")
  HIGH("High")
  NORMAL("Normal")
  LOW("Low")
  LOWER("Lower")
  LOWERST("Lowest")
}

entity Comment {
  date ZonedDateTime
  text String
}

paginate Ticket with pagination

Versions (please complete the following information):

  • JHipster React Native Version: main
@mraible
Copy link
Contributor Author

mraible commented Jun 4, 2024

I was able to fix the Error: EMFILE: too many open files, watch error with brew install watchman.

Source: https://stackoverflow.com/a/58675202/65681

@mshima
Copy link
Member

mshima commented Jun 4, 2024

We should copy the server generator from ionic.
https://github.com/jhipster/generator-jhipster-ionic/tree/main/generators/server

@mraible
Copy link
Contributor Author

mraible commented Jun 4, 2024

@mshima It's interesting that this exists because the main generator allows Ionic by default.

@mshima
Copy link
Member

mshima commented Jun 4, 2024

@mshima It's interesting that this exists because the main generator allows Ionic by default.

@mraible only for ionic serve, simulators requires capacitor://localhost and http://localhot.
See https://ionicframework.com/docs/troubleshooting/cors

@mraible
Copy link
Contributor Author

mraible commented Jun 4, 2024

@mshima Yes, you are correct. I'm wondering if we should add React Native's web by default, or remove Ionic and tell folks to add it. I kinda like that everything works when running in "dev" mode.

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