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

@accounts/magic-link being required even if you're not using it #1156

Closed
acomito opened this issue Jul 31, 2021 · 8 comments · Fixed by #1258
Closed

@accounts/magic-link being required even if you're not using it #1156

acomito opened this issue Jul 31, 2021 · 8 comments · Fixed by #1258
Milestone

Comments

@acomito
Copy link

acomito commented Jul 31, 2021

So happy to see @accounts/magic-link implemented!!!

But I think it seems to be required that you install it even if you're not using it?

I just freshly installed accountsjs and it seems to be looking for it.

@acomito acomito added the bug label Jul 31, 2021
@pradel
Copy link
Member

pradel commented Jul 31, 2021

can you paste the code you are using so I can have a look?

@bmanturner
Copy link

It also was a required peer dependency for me. Server wouldn't start without it in my package.json even though I have no idea what it is and am not using it.

@acomito
Copy link
Author

acomito commented Aug 8, 2021

Sorry for the delay @pradel


  node_modules/@accounts/server/lib/types/email-templates-type.d.ts:8:5
    8     magicLink: EmailTemplateType;
          ~~~~~~~~~
    'magicLink' is declared here.

    at createTSError (/Users/a/Desktop/web-dev/freelance/a/new/backend/node_modules/ts-node/src/index.ts:618:12)
    at reportTSError (/Users/anthony/Desktop/web-dev/freelance/a/new/backend/node_modules/ts-node/src/index.ts:622:19)
    at getOutput (/Users/a/Desktop/web-dev/freelance/a/new/backend/node_modules/ts-node/src/index.ts:809:36)
    at Object.compile (/Users/a/Desktop/web-dev/freelance/a/new/backend/node_modules/ts-node/src/index.ts:1111:30)
    at Module.m._compile (/Users/a/Desktop/web-dev/freelance/apaphani/new/backend/node_modules/ts-node/src/index.ts:1224:30)
    at Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/a/Desktop/web-dev/freelance/a/new/backend/node_modules/ts-node/src/index.ts:1228:12)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
[nodemon] app crashed - waiting for file changes before starting...
    return new TSError(diagnosticText, diagnosticCodes);
           ^
TSError: ⨯ Unable to compile TypeScript:
apollo.ts:42:50 - error TS2345: Argument of type '{ db: Mongo; tokenSecret: string; ambiguousErrorMessages: boolean; tokenConfigs: { accessToken: { expiresIn: string; }; refreshToken: { expiresIn: string; }; }; sendMail: ({ from, subject, to, text, html, }: { from?: string; subject: any; to: any; text: any; html: any; }) => Promise<...>; emailTemplates: { ...; }; s...' is not assignable to parameter of type 'AccountsServerOptions<User>'.
  Types of property 'emailTemplates' are incompatible.
    Property 'magicLink' is missing in type '{ from: string; resetPassword: { subject: () => string; text: () => string; }; passwordChanged: { subject: () => string; text: () => string; }; verifyEmail: { subject: () => string; text: () => string; }; enrollAccount: { ...; }; }' but required in type 'EmailTemplatesType'.

Once I add an email template for it, It then expects to have the package

Error: Cannot find module '@accounts/magic-link'
Require stack:

@pradel
Copy link
Member

pradel commented Aug 15, 2021

@acomito I fix the issue for the types but can you please paste the rest of the stack for this

Error: Cannot find module '@accounts/magic-link'
Require stack:

it will be helpful to debug

@rohit-gohri
Copy link

It's coming from @accounts/graphql-api

Error: Cannot find module '@accounts/magic-link'
Require stack:
- /project/node_modules/@accounts/graphql-api/lib/modules/accounts-magic-link/index.js
- /project/node_modules/@accounts/graphql-api/lib/modules/accounts/index.js
- /project/node_modules/@accounts/graphql-api/lib/modules/index.js
- /project/node_modules/@accounts/graphql-api/lib/index.js

@brent-hoover
Copy link
Contributor

Seeing the same issue with magic-link being required by @accounts/graphql-api but not included in the dependencies. Adding it alongside graphql-api fixed it but shouldn't need to do that since my package doesn't directly require it.

@acomito
Copy link
Author

acomito commented Nov 30, 2021

@zenweasel can we close this issue based on your PR?

@pradel
Copy link
Member

pradel commented Nov 30, 2021

@acomito the issue is still there, no pr to fix the issue was opened

@darkbasic darkbasic added the 1.0 label Nov 22, 2023
@darkbasic darkbasic added this to the 1.0 milestone Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants