parse-server-api-mail-adapter icon indicating copy to clipboard operation
parse-server-api-mail-adapter copied to clipboard

New Install required regenerator-runtime which is not in configuration or installation readme

Open jaysonng opened this issue 2 years ago • 11 comments

New Issue Checklist

Issue Description

Going through the installation instructions from the README file, I get an error

ReferenceError: regeneratorRuntime is not defined

Which can be solved by requiring regenerator-runtime.

A quick update to the readme file requiring and installing regenerator-runtime fixes this.

Steps to reproduce

New installation on a clean parse-server will produce this issue.

Actual Outcome

error ReferenceError: regeneratorRuntime is not defined

Expected Outcome

ReadMe should mention the requirement for regenerator-runtime for people not as tech savvy like I am.

Failing Test Case / Pull Request

Environment

  • API Mail Adapter version: 6.0.1
  • Parse Server version: 5.2.1

Logs

jaysonng avatar May 18 '22 05:05 jaysonng

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

Which version of the mail adapter are you using? There is no version 6.x.

Were you able to track down what exactly causes the error, or which part of the adapter requires that dependency? What is the dependency called, what did you add to your package.json?

mtrezza avatar May 18 '22 09:05 mtrezza

Which version of the mail adapter are you using? There is no version 6.x.

Were you able to track down what exactly causes the error, or which part of the adapter requires that dependency? What is the dependency called, what did you add to your package.json?

sorry, It's version 2.1.0

this is the exact error I get.

ReferenceError: regeneratorRuntime is not defined
    at /Users/jayson/Projects/heroku/node_modules/parse-server-api-mail-adapter/lib/ApiMailAdapter.js:155:56
    at /Users/jayson/Projects/heroku/node_modules/parse-server-api-mail-adapter/lib/ApiMailAdapter.js:192:6
 at Object.<anonymous> (/Users/jayson/Projects/heroku/node_modules/parse-server-api-mail-adapter/lib/ApiMailAdapter.js:778:2)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/jayson/Projects/heroku/node_modules/parse-server-api-mail-adapter/lib/index.js:26:46)

dependencies in package.json

    "parse-server-api-mail-adapter": "^2.1.0",
    "regenerator-runtime": "^0.13.9",

I hope that helps. I didn't look into ApiMailAdapter.js yet as installing the regenaratorRuntime in package.json and requiring it in my app.js worked for me.

jaysonng avatar May 19 '22 11:05 jaysonng

It seems that the polyfill that babel generated requires runtime, which Node version did you run this on? Not sure I would add runtime like that, you probably don't know which version babel expected, so you may run into issues.

Maybe helpful for further investigation: https://stackoverflow.com/a/56754212/1870795

mtrezza avatar May 19 '22 22:05 mtrezza

It seems that the polyfill that babel generated requires runtime, which Node version did you run this on? Not sure I would add runtime like that, you probably don't know which version babel expected, so you may run into issues.

Maybe helpful for further investigation: https://stackoverflow.com/a/56754212/1870795

i have v16.15.0 running.

So you don't encounter this problem with a new install on your end @mtrezza ?

jaysonng avatar May 20 '22 10:05 jaysonng

We have a CI that tests with Node 16 and tests pass. Do you still see this issue in the latest version?

mtrezza avatar Jan 24 '23 23:01 mtrezza

I just ran into this issue here:

Solution/Workaround

yarn add regenerator-runtime

in index.ts (or where ever): import 'regenerator-runtime';

penchef avatar Apr 27 '23 21:04 penchef

@penchef Which Node version are you using?

It's not clear at this point what requires regeneratorRuntime, it would be great to get some more info.

mtrezza avatar Apr 27 '23 21:04 mtrezza

maybe this helps:

I only ran into this when I was running tests. This is the stack trace of the error:

 ReferenceError: regeneratorRuntime is not defined

  › node_modules/parse-server-api-mail-adapter/lib/ApiMailAdapter.js:155:56
  › node_modules/parse-server-api-mail-adapter/lib/ApiMailAdapter.js:192:6
  › Object.<anonymous> (node_modules/parse-server-api-mail-adapter/lib/ApiMailAdapter.js:778:2)
  › require.extensions.<computed> (node_modules/ts-node/src/index.ts:1286:43)

Node: v18.14.2 "parse": "4.0.1", "parse-server": "6.0.0", "parse-server-api-mail-adapter": "^2.2.0", "ts-node": "^10.0.0", "ts-node-dev": "^1.1.8", "typescript": "^4.6.3"

penchef avatar Apr 27 '23 21:04 penchef

What do you see at node_modules/parse-server-api-mail-adapter/lib/ApiMailAdapter.js:155:56?

mtrezza avatar Apr 27 '23 22:04 mtrezza

We have a CI that tests with Node 16 and tests pass. Do you still see this issue in the latest version?

I have just commented out the regeneratorRuntime dependency in my package.json and so far it seems to be working fine.

jaysonng avatar May 01 '23 10:05 jaysonng

Hi, After updating the parse server to 7.2.0 I'm getting this error too. Here is the full error log:

/parse-server-api-mail-adapter/lib/ApiMailAdapter.js:133
      var _sendMail2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref4) {
                                                       ^

ReferenceError: regeneratorRuntime is not defined
    at /parse-server-api-mail-adapter/lib/ApiMailAdapter.js:133:56
    at /parse-server-api-mail-adapter/lib/ApiMailAdapter.js:166:6
    at Object.<anonymous> (/parse-server-api-mail-adapter/lib/ApiMailAdapter.js:675:2)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at Object.<anonymous> (/parse-server-api-mail-adapter/lib/index.js:25:46)

Node.js v20.9.0

MikelCalvo avatar Jul 11 '24 16:07 MikelCalvo

Maybe this: https://github.com/parcel-bundler/parcel/issues/1762#issuecomment-722558104, or remove babel altogether from this repo.

mtrezza avatar Jul 11 '24 21:07 mtrezza

Could you please try out version 4.0.0? It rebuilds the package-lock file, so maybe it fixed this issue.

mtrezza avatar Jul 12 '24 23:07 mtrezza

Could you please try out version 4.0.0? It rebuilds the package-lock file, so maybe it fixed this issue.

Can confirm, 4.0.0 is working great, thanks!

MikelCalvo avatar Jul 14 '24 22:07 MikelCalvo

Closed via https://github.com/parse-community/parse-server-api-mail-adapter/pull/94

mtrezza avatar Jul 15 '24 11:07 mtrezza