maticzav / graphql-shield

🛡 A GraphQL tool to ease the creation of permission layer.

Home Page:https://graphql-shield.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

has no exported member 'permissions' on AWS EB

lasharela opened this issue · comments

Bug report

  • I have checked other issues to make sure this is not a duplicate.

Describe the bug

src/lib/permissions.ts

import { isUserExistsByID } from "../../services";
import { shield, rule } from "graphql-shield";
import { IContext } from "../context/context.type";

const rules = {
  isUser: rule({ cache: "contextual" })(
    async (_parent, _args, { auth }: IContext) => {
      const userId = auth?.id;

      if (!userId) return false;
      const temp = await isUserExistsByID(userId);
      return temp;
    }
  ),
};

export const permissions = shield(
  {
    Query: {
      userList: rules.isUser,
      currentBalance: rules.isUser,
    },
  },
  {
    fallbackError: "User is not authenticated or has no access permission",
  }
);

it's exported from src/lib/index.ts
export { permissions } from "./middleware/permissions";

on localhost, all is working cool. But when I'm deploying on EB through AWS CodePipeline getting this error:



src/index.ts(4,19): error TS2305: Module '"./lib"' has no exported member 'permissions'.
--
127 | src/lib/index.ts(4,15): error TS2307: Cannot find module './middleware/permissions' or its corresponding type declarations.
128 | npm ERR! code ELIFECYCLE
129 | npm ERR! errno 2
130 | npm ERR! oxyn-api@10.0.2 build: `rm -rf dist && tsc &&  cp **/*.graphql dist`
131 | npm ERR! Exit status 2
132 | npm ERR!
133 | npm ERR! Failed at the oxyn-api@10.0.2 build script.
134 | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
135 |  
136 | npm ERR! A complete log of this run can be found in:
137 | npm ERR!     /root/.npm/_logs/2022-01-24T04_48_35_074Z-debug.log

Hey @lasharela 👋,

Thank you for opening an issue. We will get back to you as soon as we can. Have you seen our Open Collective page? Please consider contributing financially to our project. This will help us involve more contributors and get to issues like yours faster.

https://opencollective.com/graphql-shield

We offer priority support for all financial contributors. Don't forget to add priority label once you become one! 😄

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.