Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

DBAuth - Can't authenticate on Vercel #782

Closed
jacebenson opened this issue Aug 21, 2021 · 4 comments
Closed

DBAuth - Can't authenticate on Vercel #782

jacebenson opened this issue Aug 21, 2021 · 4 comments

Comments

@jacebenson
Copy link
Contributor

I was able to get close but still not getting success.

Here's the issue. If you make a repo, build a homepage, setup db auth, add a layout w/login/signup/logout links it works locally, but doesn't work on vercel.

Issue 1: Vercel base64's the body if there is one. This isnt handled currently. I think that code to handle this should be in here: https://github.com/redwoodjs/redwood/blob/0e49b9d86cc996d5ffe548d081887d4feed5675e/packages/api/src/functions/dbAuth/DbAuthHandler.ts#L423-L438 but... that's my guess.

Issue 2: Even when I parsed the base64'd data in auth.js, I kept getting a http response of 502 with the following message;

An error occurred with this application.

BODY_NOT_A_STRING_FROM_FUNCTION

Maybe correcting that in the typescript file will correct this, but I wasn't able to get around it.

Here's a link to the repo I was trying ot get this to work on.
it works locally but not on vercel.

@dthyresson
Copy link
Contributor

@jacebenson I’m not 100% sure you can modify the event body as here:

https://github.com/jacebenson/rw36dbauth/blob/37276e094f69d679319d73a4f5df4f0ab8084257/api/src/functions/auth.js#L11

instead could you try the decode the body into a new variable and use that instead of referencing event.body in the remaining code?

@jacebenson
Copy link
Contributor Author

Yea, Trying that seems to do the same thing. I updated the repo with the new attempt.

On login im getting

An error occurred with this application.

BODY_NOT_A_STRING_FROM_FUNCTION

@dthyresson
Copy link
Contributor

Actually, I didn't look closely at the function, but I don't think you can do this here -- or make a copy of the event.

It will need to be done in DbAuthHandler instead probably around here:

https://github.com/redwoodjs/redwood/blob/0e49b9d86cc996d5ffe548d081887d4feed5675e/packages/api/src/functions/dbAuth/DbAuthHandler.ts#L207

@jacebenson
Copy link
Contributor Author

This issue was filed on the wrong repo. But @cannikin and danny fixed this here I think.
redwoodjs/redwood#3309

It should be in the next release.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants