Closed svenaas closed 2 years ago
Closing because Federalist staging isn't Pages staging.
OK now that we have https://admin.pages-staging.cloud.gov/ I tried this again and got exactly the same error at the same point in the code, so it's not just a Pages vs. Federalist thing.
I decided to take a look at this on local.
With a clean build of current staging I visit :3000/organizations
and try and create a new org.
Attempt 1: didn't add GitHub username, entered my own GSA email address, checked "Self Authorized".
Result: a popup informing me "Invite sent to [my email] [URL]" and a new organization successfully added.
Attempt 2: didn't add GitHub username, entered my own GSA email address did not check "Self Authorized".
Result: no popup, but a new organization successfully added once again.
Cannot reproduce locally. 🤔
Tried again on Pages staging. Same error. I will note, because I didn't up above, that the org does get created, in spite of the error that occurs when creating it. I'm not sure I got that far last time, and it's good news because it means this isn't a blocker to confirming #3728.
The error shows up at /events
:
Name: error | request-handler Created: 2022-03-11 12:28PM Model: Message: Cannot read properties of null (reading 'id')
In the pages-staging
logs I find
uncaughtException: Cannot read properties of null (reading 'id')
TypeError: Cannot read properties of null (reading 'id')
at Object.createOrganization (/home/vcap/app/api/services/organization/Organization.js:207:62)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async create (/home/vcap/app/api/admin/controllers/organization.js:70:48)
Where line 207 of the Organization service in the async createOrganization
method is
await org.addUser(user, { through: { roleId: managerRole.id } });
where managerRole was supposed to have been initialized by
const managerRole = await Role.findOne({ where: { name: 'manager' } });
Seeded user
and manager
roles in staging
and was able to create an organization via admin.pages-staging.cloud.gov
without an error.
As a follow up, we should create a file for seed data that should be run in all new environments, which is separate from the sample data we use when developing locally.
In Slack, I noted that
In local dev
create-dev-data
seeds some manager users, one with and one without GitHub. Is it possible that no such manager users exist on staging? Role doesn't appear to be shown at admin/users
and I have not yet tried spelunking in the database, though I'm close to that point now.
@davemcorwin deduced that it's the seeding of the role types themselves that's missing, and created #3811 to track the work of addressing this.
Oh, sorry @davemcorwin. I didn't notice that you'd done the seeding manually. Moving this back.
Creating a new organization raises a 500 on staging on POST to /admin/organizations
Steps to reproduce:
The console shows
and