thgh / payload-plugin-oauth

Add oAuth sign in to your Payload CMS site
MIT License
83 stars 15 forks source link

Check release 0.1.7 / 0.2.0 #7

Closed pascalgn closed 1 year ago

pascalgn commented 1 year ago

I believe the release for #5 might have an issue, because when I look at npm: https://www.npmjs.com/package/payload-plugin-oauth?activeTab=code

I still find this line, which should have || webpackConfig at the end, I believe! 😬

const config = ((_b = (_a = incoming.admin) === null || _a === void 0 ? void 0 : _a.webpack) === null || _b === void 0 ? void 0 : _b.call(_a, webpackConfig)) || {};

The original error I got was

TypeError: Cannot read properties of undefined (reading 'publicPath')
    at initWebpack (my-project/node_modules/payload/src/webpack/init.ts:18:14)
    at initAdmin (my-project/node_modules/payload/src/express/admin.ts:29:34)
    at initHTTP (my-project/node_modules/payload/src/initHTTP.ts:51:14)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at Payload.init (my-project/node_modules/payload/src/index.ts:14:21)

and an easy workaround is to simply change the payload config like this:

export default buildConfig({
  // ...
  admin: {
    user: Users.slug,
    webpack: config => config,    // <-- add this line
  },
  // ...
});
thgh commented 1 year ago

Indeed that's a bug that should be released soon! I have several other fixes that I would like to add to. Like removing the dependency on the plaintext password.

thgh commented 1 year ago

Hi, do you mind trying again with v0.3.0?

pascalgn commented 1 year ago

With 0.3.0, I get a different error:

Error! Error: Cannot find module 'connect-mongo'
Require stack:
- ~/my-project/node_modules/payload-plugin-oauth/dist/index.js
- ~/my-project/src/plugins.ts
- ~/my-project/src/config.ts
- ~/my-project/node_modules/payload/dist/config/load.js
- ~/my-project/node_modules/payload/dist/payload.js
- ~/my-project/node_modules/payload/dist/initHTTP.js
- ~/my-project/node_modules/payload/dist/index.js
- ~/my-project/src/server.ts
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1021:15)
    at Function.Module._load (node:internal/modules/cjs/loader:866:27)
    at Module.require (node:internal/modules/cjs/loader:1093:19)
    at require (node:internal/modules/cjs/helpers:108:18)

Somehow I cannot see the changes in the repository, but when looking at my node_modules folder, it looks like "connect-mongo" has been added as a dependency. But it's in devDependencies, so it's not used by depending modules

thgh commented 1 year ago

Ow, will fix! You can workaround it by installing it with npm install connect-mongo

thgh commented 1 year ago

Released v0.3.1