Apollo-link: Error when deploying to `now`: > node_modules/@types/zen-observable/index.d.ts(31,14): error TS2300: Duplicate identifier 'Subscriber'.

Created on 18 Jan 2018  ·  10Comments  ·  Source: apollographql/apollo-link

I'm trying to deploy the typescript-advanced GraphQL boilerplate with now.

Intended outcome:

Successful deploy of the app

Actual outcome:

I'm getting the following error message when running now:

~/D/tsa2 $ now --dotenv .env 
> Deploying ~/Desktop/tsa2 under [email protected]
> Using Node.js 8.9.4 (default)
> Ready! https://tsa2-dmkjibtmcx.now.sh (copied to clipboard) [4s]
> You ([email protected]) are on the OSS plan. Your code and logs will be made public.
> NOTE: You can use `now --public` to skip this prompt
> Synced 2 files (1.16KB) [2s] 
> Initializing…

> Building
> ▲ npm install
> ✓ Using "yarn.lock"
> ⧗ Installing 13 main dependencies…
> ✓ Installed 907 modules [12s]
> ▲ npm run build
> > tsa2@ build /home/nowuser/src
> > rimraf dist && tsc
> node_modules/@types/zen-observable/index.d.ts(31,14): error TS2300: Duplicate identifier 'Subscriber'.
> npm ERR! code ELIFECYCLE
> npm ERR! errno 2
> npm ERR! tsa2@ build: `rimraf dist && tsc`
> npm ERR! Exit status 2
> npm ERR! 
> npm ERR! Failed at the tsa2@ build script.
> npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
> npm ERR! A complete log of this run can be found in:
> npm ERR!     /home/nowuser/.npm/_logs/2018-01-18T09_18_09_092Z-debug.log
> Error! The build step of your project failed. To retry, run `now --force`.

Because the issue is around typings of zen-observable which is dependency from apollo-link, I assume it has something to do with the dependency structure of apollo-link.

Note that building locally with yarn build succeeds.

How to reproduce the issue:

graphql create my-app --boilerplate typescript-advanced
cd my-app
now --dotenv .env # assumes you have the now CLI installed

Note:

The issue can be resolved with a temporary workaround which is manually editing the yarn.lock as described in this forum post.

Most helpful comment

@timneutkens from the Zeit team is looking into this! 💪

All 10 comments

Same error here

I've done some initial looking and I'm not sure 1. what nows problem is, and 2. that this is an apollo-link issue. The types for ZenObservable intentionally nest Subscriber under a namespace to avoid conflicts in this case with potentially rxjs which also has a Subscriber.

Does anyone have any ideas the kind of environment now uses when building? I can't replicate this locally or on a CI. Can we ping the zeit team on this?

@timneutkens from the Zeit team is looking into this! 💪

Woho! https://github.com/zeit/now-cloud/issues/43 is solved now thanks to @TooTallNate 🎉
@nikolasburk can you confirm this works and close the corresponding issues?

Please let me know that it's working correctly for you!

Works for me

Yep, the typescript-advanced can now be deployed with now! Thanks so much @TooTallNate and @jbaxleyiii for looking into this 🙌

This is super cool, thanks everyone involved! 🙏

I'm trying to use apollo-client-preset in TypeScript but still get this error

This appears to allow it to function correctly but is only a workaround.

// tsconfig.json
{
  "compilerOptions": {
    ...
    "module": "esnext",
    "target": "esnext",
    "lib": [
      "es6",
      "dom",
      "es2015.core",
      "es2015.collection",
      "es2015.generator",
      "es2015.iterable",
      "es2015.promise",
      "es2015.proxy",
      "es2015.reflect",
      "es2015.symbol",
      "es2015.symbol.wellknown",
      "esnext.asynciterable"
    ],
    ...
    "skipLibCheck": true,
    ...
  },
  "exclude": [
     ...
  ]
}
Was this page helpful?
0 / 5 - 0 ratings