parse-community / parse-server-api-mail-adapter

API Mail Adapter for Parse Server
MIT License
27 stars 17 forks source link

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

Closed jaysonng closed 2 months ago

jaysonng commented 2 years ago

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

Logs

parse-github-assistant[bot] commented 2 years ago

Thanks for opening this issue!

mtrezza commented 2 years ago

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?

jaysonng commented 2 years ago

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.

mtrezza commented 2 years ago

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

jaysonng commented 2 years ago

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 ?

mtrezza commented 1 year ago

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

penchef commented 1 year ago

I just ran into this issue here:

Solution/Workaround

yarn add regenerator-runtime

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

mtrezza commented 1 year ago

@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.

penchef commented 1 year ago

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"

mtrezza commented 1 year ago

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

jaysonng commented 1 year ago

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.

MikelCalvo commented 2 months ago

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
mtrezza commented 2 months ago

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

mtrezza commented 2 months ago

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

MikelCalvo commented 2 months ago

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!

mtrezza commented 2 months ago

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