You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Do you want to request a feature or report a bug? Bug
- What is the current behavior?
The signup hook response is not parsed, if it doesn't consist of a Content-Type header value. In my hook I was trying to set app_metadata.roles but my value is ignored.
Here's the code and the blame.I think this was added to avoid json parse errors, but POST responses can often have no known length. I think there should still be a check, but on the body text itself, not the header value.
- If the current behavior is a bug, please provide the steps to reproduce.
I stripped out error handling and left out some details that any gotrue dev should know, but this code should work. I copy/pasted snippets from my project.
Create and launch an empty netlify nuxt project with netlify-identity. You may need to register with netlify.
yarn create nuxt-app gotrue-test
cd gotrue-test
yarn add -g netlify-cli
yarn add netlify-identity-widget
yarn add -D dotenv jest
netlify dev --live
Write a functions/identity-signup/identity-signup.js, that doesn't return a content-length:
exports.handler = function (event, context, callback) {
const bodyJson = JSON.parse(event.body).user
if (bodyJson.event === 'signup') {
bodyJson.app_metadata.roles = ['regular']
}
const bodyText = JSON.stringify(bodyJson)
callback(null, {
statusCode: 200,
headers: {
// WORKAROUND: Uncomment next line as a fix
// 'Content-Length': bodyText.length,
},
body: bodyText,
})
}
Write .env for gotrue and jest to auto-confirm, auto-signup
This issue has been automatically marked as stale because it has not had activity in 1 year. It will be closed in 7 days if no further activity occurs. Thanks!
- Do you want to request a feature or report a bug? Bug
- What is the current behavior?
The signup hook response is not parsed, if it doesn't consist of a
Content-Type
header value. In my hook I was trying to setapp_metadata.roles
but my value is ignored.Here's the code and the blame.I think this was added to avoid json parse errors, but
POST
responses can often have no known length. I think there should still be a check, but on the body text itself, not the header value.- If the current behavior is a bug, please provide the steps to reproduce.
I stripped out error handling and left out some details that any gotrue dev should know, but this code should work. I copy/pasted snippets from my project.
functions/identity-signup/identity-signup.js
, that doesn't return a content-length:.env
for gotrue and jest to auto-confirm, auto-signupgotrue
jest
code:- What is the expected behavior?
app_metadata
should be modified. See test code above. If you uncomment my workaround, it works correctly.- Please mention your Go version, and operating system version.
1.15 as comes with
golang:1.15-alpine
docker image. I use this to buildgotrue
. This is the same as in go.mod.The text was updated successfully, but these errors were encountered: