Skip to content
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

Bug forgot password #3851

Closed
Wykaz opened this issue Sep 19, 2022 · 8 comments
Closed

Bug forgot password #3851

Wykaz opened this issue Sep 19, 2022 · 8 comments
Labels
kind/bug Something isn't working status/done

Comments

@Wykaz
Copy link

Wykaz commented Sep 19, 2022

What is the problem?

On a new project, the forgotten password option does not work.

Paste all your error logs here:

wait  - compiling /auth/forgot-password (client and server)...
event - compiled client and server successfully in 614 ms (299 modules)
Warning: Received `true` for a non-boolean attribute `global`.

If you want to write it to the DOM, pass a string instead: global="true" or global={value.toString()}.
    at style
    at form
    at ReactFinalForm
    at Form
    at Layout
    at ForgotPasswordPage
    at BlitzAuthInnerRoot
    at ErrorBoundary
    at MyApp
    at Hydrate
    at QueryClientProvider
    at BlitzProvider
    at BlitzOuterRoot
    at WithSuperJSON
    at StyleRegistry
    at AppContainer
    at AppContainerWithIsomorphicFiberStructure
    at div
    at Body
Warning: Received `true` for a non-boolean attribute `jsx`.

If you want to write it to the DOM, pass a string instead: jsx="true" or jsx={value.toString()}.
    at style
    at form
    at ReactFinalForm
    at Form
    at Layout
    at ForgotPasswordPage
    at BlitzAuthInnerRoot
    at ErrorBoundary
    at MyApp
    at Hydrate
    at QueryClientProvider
    at BlitzProvider
    at BlitzOuterRoot
    at WithSuperJSON
    at StyleRegistry
    at AppContainer
    at AppContainerWithIsomorphicFiberStructure
    at div
    at Body
wait  - compiling /api/rpc/[[...blitz]]...
event - compiled successfully in 362 ms (138 modules)
21:57:39.470 INFO  /forgotPassword() Starting with input: 
{
  email: 'test@test.com'
}
21:57:41.933 INFO  /forgotPassword() Finished: resolver:2.4s serializer:9ms total:2.5s 
error - uncaughtException: Error: spawn undefined\System32\WindowsPowerShell\v1.0\powershell ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:478:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn undefined\\System32\\WindowsPowerShell\\v1.0\\powershell',
  path: 'undefined\\System32\\WindowsPowerShell\\v1.0\\powershell',
  spawnargs: [
    '-NoProfile',
    '-NonInteractive',
    '–ExecutionPolicy',
    'Bypass',
    '-EncodedCommand',
    'UwB0AGEAcgB0ACAAIgBmAGkAbABlADoALwAvAEMAOgBcAFUAcwBlAHIAcwBcAFQAaABvAG0AYQBzAFwAQQBwAHAARABhAHQAYQBcAEwAbwBjAGEAbABcAFQAZQBtAHAALwA2AGMAMQBlADYAZgA2ADkALQBiAGUAZgBlAC0ANAAxAGUAMwAtADgANgAwADMALQAxADYANwAxADIAZABhADgAYgBmADkANgA
uAGgAdABtAGwAIgA='
  ]
}

Paste all relevant code snippets here:

I think it comes from here

mailers/forgetPasswordMailer.js

// Preview email in the browser
        const previewEmail = (await import("preview-email")).default
        await previewEmail(msg)

What are detailed steps to reproduce this?

  1. npm install -g blitz
  2. blitz new blitzjs-test
  3. cd blitzjs-test
  4. blitz dev
  5. View your brand new app at http://localhost:3000/
  6. Create an account.
  7. Click on "Logout".
  8. Go to the login page.
  9. Click on "Forgot your password?".
  10. A console error

Run blitz -v and paste the output here:

Blitz version: 2.0.0-beta.3 (global)
Blitz version: 2.0.0-beta.3 (local)
Windows 10 | win32-x64 | Node: v16.17.0


 Package manager: npm

  System:
    OS: Windows 10 10.0.19044
    CPU: (4) x64 Intel(R) Core(TM) i5-3340 CPU @ 3.10GHz
    Memory: 4.18 GB / 15.95 GB
  Binaries:
    Node: 16.17.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD
  npmPackages:
    @blitzjs/auth: 2.0.0-beta.3 => 2.0.0-beta.3
    @blitzjs/next: 2.0.0-beta.3 => 2.0.0-beta.3
    @blitzjs/rpc: 2.0.0-beta.3 => 2.0.0-beta.3
    @prisma/client: 4.0.0 => 4.0.0
    blitz: 2.0.0-beta.3 => 2.0.0-beta.3
    next: 12.2.5 => 12.2.5
    prisma: 4.0.0 => 4.0.0
    react: 18.2.0 => 18.2.0
    react-dom: 18.2.0 => 18.2.0
    typescript: ^4.5.3 => 4.8.3

Please include below any other applicable logs and screenshots that show your problem:

No response

@Wykaz Wykaz added kind/bug Something isn't working status/triage labels Sep 19, 2022
@dillondotzip
Copy link
Member

I just tested on osx and it's working. By the looks of your error this may be a window specific issue.

@Zeko369
Copy link
Collaborator

Zeko369 commented Sep 30, 2022

@Wykaz can you check if you something else set to open .html files in windows settings? If you don't have anything set it prompts you. If you have it set to something else change it to your default browser

image

image

@Wykaz
Copy link
Author

Wykaz commented Oct 2, 2022

I have a browser configured for you to open .html but it does not work.
image

@Zeko369
Copy link
Collaborator

Zeko369 commented Oct 3, 2022

@Wykaz there could be a problem with where it stores the files, try changing await previewEmail() to this and create a tmp folder in the root of your project

await previewEmail(msg, { open: true, dir: join(process.cwd(), "./tmp") })

@Wykaz
Copy link
Author

Wykaz commented Oct 3, 2022

Thank you for taking the time to resolve the issue.
It was this import?

import { join } from "path"

I tried with it and it doesn't work, it gives the same error.

@siddhsuresh
Copy link
Member

siddhsuresh commented Oct 4, 2022

@Wykaz I think the problem lies with previewEmail not being able to read your process.env.SYSTEMROOT environment variable to launch PowerShell

path: 'undefined\\System32\\WindowsPowerShell\\v1.0\\powershell',

The path to PowerShell should have been "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell"

Can you check if the problem resolves if you manually set the systemroot in your project's .env file as

SYSTEMROOT = C:\\WINDOWS

or the output that you get when executing

image

@Wykaz
Copy link
Author

Wykaz commented Oct 4, 2022

I added dfgdfg in the .env file and it works. Thanks

But when I do this to modify the .env file the variable was good
image

@adamtang79
Copy link

May I know why

SYSTEMROOT="C:\WINDOWS"

is not working if i put it only inside .env.local but it is working if i put it only inside .env?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working status/done
Projects
Status: Done
Development

No branches or pull requests

7 participants