Ory Elements bugs on recovery flow: Hi everyone, ...
# ory-network
w
Ory Elements bugs on recovery flow: Hi everyone, are these known bugs in Ory Elements: 1. The
resend code
link over the code input is not working, and the error in the console is:
Error: No variant of UpdateRecoveryFlowBody exists with 'method=undefined'
2. when going through recovery flow, if entering a non-existent email, everything works, but if entering en email of an account registered via OIDC, we get 400 error response and a JS error in console:
Copy code
{
  "code": 500,
  "status": "Internal Server Error",
  "request": "64f33c3b-5837-95e0-92cc-963823812d63",
  "message": "template: https://storage.googleapis.com/bac-gcs-production/1d1273267dad359a9a0082ddf566c65033f5cd9e024bfc10304169b5626565bc0a064f5789238ffef9437610563ab0a6f376ac914ae68717398b1ac3113a1833.txt:1:19: executing \"https://storage.googleapis.com/bac-gcs-production/1d1273267dad359a9a0082ddf566c65033f5cd9e024bfc10304169b5626565bc0a064f5789238ffef9437610563ab0a6f376ac914ae68717398b1ac3113a1833.txt\" at .Identity.metadata_public.lang: nil pointer evaluating interface {}.lang"
}
Uncaught (in promise) TypeError: Cannot use 'in' operator to search for 'continue_with' in undefined
b
Hi, thanks for the report. 1. The resend code feature works just fine for me, could you share some more on your setup? 2. There's an error in you email template, we're not handling that error well in Ory Elements yet, but if you fix the error in the template the issue should go away.
w
1. We are using
import { Recovery } from '@ory/elements-react/theme'
in a next.js environment, what context would you need me to provide? We do have some modifications around the component, but the code pretty much boils down to:
Copy code
export default async function RecoveryPage() {
  const { flow } = await getAuthFlowAction('recovery', props.searchParams) // calls `getRecoveryFlow` under the hood

  return (
          <Recovery
            flow={flow}
            config={appData.config}
            components={{
              Card: {
                Header: appData.RecoveryHeader,
              },
            }}
          />
  )
}
2. Sorry, what kind of error? Why is the email sent in other cases? I would appreciate if you point it to me — I can't figure out from the error itself. What actually should happen if a reset password called for an email that is OIDC?
b
Seems like your Datamapping is not setup to populate the identity's metadata to add the lang field, but your email template expects it. If the metadata_public.lang field exists, the email template is executed correctly.
w
Ok, I'll look into it, thank you! Have you had a chance to look into the
Resend code
bug?
hi @bland-eye-99092 have you had a chance to look into the
Resend code
issue?
b
The code you shared is exactly what our examples use, so it’s definitely not that. Any additional information would be great!
w
@bland-eye-99092 hi! important update here: you need to click twice, because the first time you click it works, the second — it throws an error. the flow that is rendering the form wih the code:
Copy code
{
  "active": "code",
  "expires_at": {},
  "id": "cdf6b040-a6f4-4fc0-aa07-4fa6a504e4bf",
  "issued_at": {},
  "request_url": "http://localhost:3000/self-service/recovery/browser?app=creator&flow=d82ab1f8-03ad-44f9-9cf9-23bd59bee5ea&return_to=https%3A%2F%2Fapp.metapic.dev%2F",
  "return_to": "https://app.metapic.dev/",
  "state": "sent_email",
  "type": "browser",
  "ui": {
    "action": "http://localhost:3000/self-service/recovery?flow=cdf6b040-a6f4-4fc0-aa07-4fa6a504e4bf",
    "messages": [
      {
        "id": 1060003,
        "text": "An email containing a recovery code has been sent to the email address you provided. If you have not received an email, check the spelling of the address and make sure to use the address you registered with.",
        "type": "info"
      }
    ],
    "method": "POST",
    "nodes": [
      {
        "attributes": {
          "disabled": false,
          "name": "csrf_token",
          "node_type": "input",
          "required": true,
          "type": "hidden",
          "value": "CTcpIYN4xJG7UFcPp2HHAJvr+aP+JJM6uKDcq8Q4Z3yGpGMLOuKo2Nlq6JiO092bTOJMFplIP1ZFrZIyyL6uEw=="
        },
        "group": "default",
        "messages": [],
        "meta": {},
        "type": "input"
      },
      {
        "attributes": {
          "disabled": false,
          "maxlength": 6,
          "name": "code",
          "node_type": "input",
          "pattern": "[0-9]+",
          "required": true,
          "type": "text"
        },
        "group": "code",
        "messages": [],
        "meta": {
          "label": {
            "id": 1070010,
            "text": "Recovery code",
            "type": "info"
          }
        },
        "type": "input"
      },
      {
        "attributes": {
          "disabled": false,
          "name": "method",
          "node_type": "input",
          "type": "hidden",
          "value": "code"
        },
        "group": "code",
        "messages": [],
        "meta": {},
        "type": "input"
      },
      {
        "attributes": {
          "disabled": false,
          "name": "method",
          "node_type": "input",
          "type": "submit",
          "value": "code"
        },
        "group": "code",
        "messages": [],
        "meta": {
          "label": {
            "id": 1070009,
            "text": "Continue",
            "type": "info"
          }
        },
        "type": "input"
      },
      {
        "attributes": {
          "disabled": false,
          "name": "email",
          "node_type": "input",
          "type": "submit",
          "value": "[email protected]"
        },
        "group": "code",
        "messages": [],
        "meta": {
          "label": {
            "id": 1070008,
            "text": "Resend code",
            "type": "info"
          }
        },
        "type": "input"
      }
    ]
  }
}
and stacktrace from localhost:
b
Ahh, thank you! That makes sense. Could you create a GitHub issue in ory/network for this? I'll add it to our backlog, and we'll get it sorted ASAP. We have also made a pre-release recently that might already resolve this issue, could you try and see if this is reproducible in v1.2.0-rc.1?
w
we indeed have an older version, because updating to the latest was breaking our customisation chnages, but I'll try to do this today and see if (despite broken UI) it is still reproducible
ok, so this update indeed fixes it. do you think you will release this soon? or how safe is it to update to
1.2.0-rc.1
?
b
It’s fairly stable but we still have a few things to cleanup before the full 1.2.0 release.
w
ok, thank you!
w
Hey @bland-eye-99092! We found that 1.2.0-rc.1 does not send disabled fields, such as email. We are using this to predefine the email in the registration form for registration via invitation. Is it on purpose, or is it a bug?
b
Can you share the code (DM is fine)? That's not really a feature we test for, but in general I don't see a reason that shouldn't work.