juanbzpy / next-csrf

CSRF mitigation for Next.js
https://npm.im/next-csrf
MIT License
140 stars 22 forks source link

Env cannot load into _app.ts #5

Closed JasonDevTech closed 2 years ago

JasonDevTech commented 4 years ago

Following the example given in your README, there is one issue regarding the csrfToken being passed down as props in the custom app. Whenever I try to pass it down, it will give me the error Module not found: Can't resolve 'fs' in [DIRECTORY] Error from chokidar (C:\): Error: EBUSY: resource busy or locked, lstat 'C:\hiberfil.sys' which indicates to me there is an issue loading the .env into the module. In addition, there is an error thrown here: TypeError: Cannot read property 'inherits' of undefined at Object.<anonymous> (.....\node_modules\next-csrf\dist\next-csrf.js:107:21)

Next.js version: next@latest

elegisandi commented 4 years ago

@j0lv3r4 following the instructions, i've encountered same error

TypeError: Cannot read property 'inherits' of undefined

im using nexjs 9.4.2

juanbzpy commented 3 years ago

@SemperFortis @elegisandi I'm fixing the TypeError bug in this PR https://github.com/j0lv3r4/next-csrf/pull/6, however, the functionality changed drastically.

For the environment variable issue, I can't reproduce it, however I added an example to the PR that works fine. Please let me know if you keep seeing that error on the example.

I will update the PR with more info.