swensonhe / strapi-firebase-auth

MIT License
20 stars 8 forks source link

Internal Server error on firebase-auth endpoint #47

Open spawnrider opened 11 months ago

spawnrider commented 11 months ago

Describe the bug After request for token verification twice using the /firebase-auth endpoint, I encoutering this issue :

{
    "data": null,
    "error": {
        "status": 500,
        "name": "InternalServerError",
        "message": "Internal Server Error"
    }
}

To Reproduce

Expected behavior The following response :

{
    "user": {
        "id": 10,
        "username": "yohann.ciurlik",
        "email": "yohann.ciurlik@xxx.com",
        "provider": null,
        "confirmed": true,
        "blocked": false,
        "createdAt": "2023-12-11T19:09:54.649Z",
        "updatedAt": "2023-12-11T19:09:54.649Z"
    },
    "jwt": "MY_TOKEN"
}

Screenshots

[2023-12-11 20:03:40.358] error: select `t0`.* from `up_users` as `t0` where (`t0`.`firebaseUserID` = 'xFveGqn0OaRVTdcLyQRCmmNpYd93') limit 1 - no such column: t0.firebaseUserID
ValidationError: select `t0`.* from `up_users` as `t0` where (`t0`.`firebaseUserID` = 'XYZ') limit 1 - no such column: t0.firebaseUserID
    at /Users/yciurlik/Documents/Dev/Playground/Strapi/demoV4/node_modules/@swensonhe/strapi-plugin-firebase-auth/server/services/firebaseService.js:206:35
    at step (/Users/yciurlik/Documents/Dev/Playground/Strapi/demoV4/node_modules/@swensonhe/strapi-plugin-firebase-auth/server/services/firebaseService.js:33:23)
    at Object.next (/Users/yciurlik/Documents/Dev/Playground/Strapi/demoV4/node_modules/@swensonhe/strapi-plugin-firebase-auth/server/services/firebaseService.js:14:53)
    at fulfilled (/Users/yciurlik/Documents/Dev/Playground/Strapi/demoV4/node_modules/@swensonhe/strapi-plugin-firebase-auth/server/services/firebaseService.js:5:58)

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

martinforsberg99 commented 11 months ago

Hello @spawnrider, Did you find a way around this? I am having the same issue.

spawnrider commented 11 months ago

@martinforsberg99 unfortunately no, there is a missing column (and the associated mechanism) to create a join between the users table and objects from Firebase. I didn't look in detail :(

nkamod commented 10 months ago

Have you tried creating that column manually in the users table ? In my case I was trying to integrate phone auth.

 error: select `t0`.* from `up_users` as `t0` where (`t0`.`phoneNumber` = '+16505551234') limit 1 - ER_BAD_FIELD_ERROR: Unknown column 't0.phoneNumber' in 'where clause'
Error: ER_BAD_FIELD_ERROR: Unknown column 't0.phoneNumber' in 'where clause'

So, I just created the phoneNumber and firebaseUserID column in the user collection.

espython commented 10 months ago

Describe the bug After request for token verification twice using the /firebase-auth endpoint, I encoutering this issue :

{
    "data": null,
    "error": {
        "status": 500,
        "name": "InternalServerError",
        "message": "Internal Server Error"
    }
}

To Reproduce

  • With no strapi user XYZ
  • Try to authentificate XYZ using /firebase-auth endpoint, the first time the XYZ strapi user is created,
  • Try to authenticate a second time using /firebase-auth endpoint, the issue is occuring.

Expected behavior The following response :

{
    "user": {
        "id": 10,
        "username": "yohann.ciurlik",
        "email": "yohann.ciurlik@xxx.com",
        "provider": null,
        "confirmed": true,
        "blocked": false,
        "createdAt": "2023-12-11T19:09:54.649Z",
        "updatedAt": "2023-12-11T19:09:54.649Z"
    },
    "jwt": "MY_TOKEN"
}

Screenshots

[2023-12-11 20:03:40.358] error: select `t0`.* from `up_users` as `t0` where (`t0`.`firebaseUserID` = 'xFveGqn0OaRVTdcLyQRCmmNpYd93') limit 1 - no such column: t0.firebaseUserID
ValidationError: select `t0`.* from `up_users` as `t0` where (`t0`.`firebaseUserID` = 'XYZ') limit 1 - no such column: t0.firebaseUserID
    at /Users/yciurlik/Documents/Dev/Playground/Strapi/demoV4/node_modules/@swensonhe/strapi-plugin-firebase-auth/server/services/firebaseService.js:206:35
    at step (/Users/yciurlik/Documents/Dev/Playground/Strapi/demoV4/node_modules/@swensonhe/strapi-plugin-firebase-auth/server/services/firebaseService.js:33:23)
    at Object.next (/Users/yciurlik/Documents/Dev/Playground/Strapi/demoV4/node_modules/@swensonhe/strapi-plugin-firebase-auth/server/services/firebaseService.js:14:53)
    at fulfilled (/Users/yciurlik/Documents/Dev/Playground/Strapi/demoV4/node_modules/@swensonhe/strapi-plugin-firebase-auth/server/services/firebaseService.js:5:58)

Desktop (please complete the following information):

  • OS: Mac OS Sonoma
  • Browser : Chrome
  • Version v120

Additional context Add any other context about the problem here.

you need to add the phoneNumber and firebaseUserID column in the user collection as @nkamod mentioned

espython commented 10 months ago

@spawnrider please let me know if you still facing this issue After creating the missing columns in your user collection

olyphotographer commented 9 months ago

I had the same problem using Apple signin, it works now after adding fields "firebaseUserID" and "phoneNumber". I'm not sure if phoneNumber is required.

kris-cc3 commented 7 months ago

worked when you firebaseUserID to the user model, maybe add this in model change into the instructions?