-
Notifications
You must be signed in to change notification settings - Fork 98
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
Feathers trying to populate nonexistent columns "0" and "1" #206
Comments
Hi, I am not familiar with Knex but it might be useful you detail your app setup and the payload sent to the endpoint, thanks. |
Hi! Thank you for any input and assistance in advance! In services/auth-management/auth-management.service.js
services/index.ts :
Payload from postman to
Response: If I create the 0 and 1 columns in the database:
|
Thank you for the detailed report, @madebyjono! I never used the short token verification, and I am not familiar with Knex... But as far as I can see, you did everything as documented incl. setting The user object if fetched by f-a-m in this code: feathers-authentication-management/src/methods/verify-signup.ts Lines 87 to 93 in 1990797
where identifyUser should be { "cellphone": "12345678" } in your example.
Maybe this object is not send correctly to Feathers, so that it was interpreted as a String? Can you verify the SQL statement e.g. by enabling logging in Knex? |
Thank you, @OnnoGabriel , With knex debugging on, I'm getting the error below:
No idea why its looking for colums "0" and "1"! |
Agreed, the UPDATE statement is wrong. Is should just be: update "users" set "isVerified" = $1, "verifyToken" = $2, "verifyShortToken" = $3, "verifyExpires" = $4 "verifyChanges" = $5 where "users"."id" in ($6) Unfortunalety, I do not have any idea, where the fields "0" and "1" could come from. The SQL is created by the patch request here: feathers-authentication-management/src/methods/verify-signup.ts Lines 120 to 141 in 5c9b78e
The only way to extent the Sorry, that I cannot be of more help. I am not using f-a-m with Feathers 5 and Knex yet. |
Could it be somewhat related to #197 ? |
Hey @madebyjono, did you by any chance manage to figure out a workaround for this bug? I have a similar setup as you described and I'm facing the same issue as well. Would appreciate any solutions. Thanks. |
Hi @crklan, I haven't looked at it since, but in #197 as claustres mentioned, the 'hack' could be a workaround. I'll try it out when I have the time - unless you beat me to it. |
Hi, added fix for this problem in #216 |
I'm using postgresql v15.1 with a fresh installation of feathers
Followed the setup instructions to the T
In posting to my authentication 'users' endpoint:
http://localhost:3030/auth-management/verify-signup-short
I'm getting:
error: error: update "users" set "0" = $1, "1" = $2, "isVerified" = $3, "verifyToken" = $4, "verifyShortToken" = $5, "verifyExpires" = $6, "verifyChanges" = $7 where "users"."id" in ($8) - column "0" of relation "users" does not exist
When I manually create the columns "0" and "1" in the database, the rows are populated with a "{" and "}" for both of them.
Been dealing with it for a whole day and can't seem to figure it out!
My migration for users is
`export async function up(knex: Knex): Promise {
await knex.schema.createTable('users', (table) => {
table.increments('id');
table.integer('cellphone');
table.string('email').unique();
table.string('password');
table.string('verifyShortToken');
table.bigInteger('verifyExpires');
table.integer('resetAttempts');
table.integer('resetExpires');
table.string('resetShortToken')
table.string('resetToken');
table.string('verifyChanges');
table.boolean('isVerified');
table.string('verifyToken');
})
}
export async function down(knex: Knex): Promise {
await knex.schema.dropTable('users')
}`
Expected behavior
Successful verification of short token
Actual behavior
getting error
{ "name": "GeneralError", "message": "update \"users\" set \"0\" = $1, \"1\" = $2, \"isVerified\" = $3, \"verifyToken\" = $4, \"verifyShortToken\" = $5, \"verifyExpires\" = $6, \"verifyChanges\" = $7 where \"users\".\"id\" in ($8) - column \"0\" of relation \"users\" does not exist", "code": 500, "className": "general-error" }
NodeJS version:
18.15.0
Operating System:
MacOS
The text was updated successfully, but these errors were encountered: