Skip to main content

Hi,

 

I am developing a Zapier integration with our API. I am building this in NodeJS using the Zapier Platform CLI.

I started the project with typescript using `zapier init {name}`.

Then I installed our projects types, which are present in our monorepo. We use this monorepo design, so we have a central types library which will always be up-to-date when developing. This means that whenever we add something to an endpoint, we are forced to change these types everywhere on the spot.

We are not pushing this types library to NPM, but we keep it in the monorepo and install it from there.

The monorepo looks a bit like this:

monorepo/
├─ src/
│ ├─ libs/
│ │ ├─ types/
│ │ │ ├─ package.json
│ ├─ zapier/
│ │ ├─ package.json
│ ├─ some-service/
│ │ ├─ package.json
├─ package.json

The monorepo has a package.json containing the following:

{
"name": "@project/root",
"version": "0.0.2",
"private": true,
"description": "",
"license": "UNLICENSED",
"author": "",
"workspaces": s
"src/*",
"src/libs/*",
],
}

The workspaces give each project the ability to install local packages, for example:

  • some-service can now run `npm install --save-dev @project/types` locally, without referring to NPM
  • zapier can now run `npm install --save-dev @project/types` locally, also without referring to NPM

Now whenever I run `npm install` in the zapier folder, it works perfectly. When I run `npm run build` from the zapier folder, it works perfectly. But when I run `zapier push` I get the following errors:

❯ zapier push
✔ Copying project to temp directory
✖ Installing project dependencies
› Error: npm WARN config production Use `--omit=dev` instead.
› npm ERR! code E404
› npm ERR! 404 Not Found - GET https://registry.npmjs.org/@project%2ftypes - Not found
› npm ERR! 404
› npm ERR! 404 '@project/types@^1.0.0' is not in this registry.
› npm ERR! 404
› npm ERR! 404 Note that you can also install from a
› npm ERR! 404 tarball, folder, http url, or git url.

› npm ERR! A complete log of this run can be found in:
› npm ERR! /Users/jacob/.npm/_logs/2023-02-23T14_06_40_659Z-debug-0.log

How would I go into solving this issue without publishing our package to NPM? Publishing the package to NPM is *not* a solution, as it does not fit within our working structure.

Hey @jacobk 👋

If you build your app using the CLI version of our developer platform, you are able to import public NPM packages.

If you want to import a private package, you would want to try to create a read-only token specifically for Zapier and add that to the .npmrc file.

This doc may be helpful: https://docs.npmjs.com/using-private-packages-in-a-ci-cd-workflow


Hi again @jacobk 😀

Another suggestion I found to use private packages - try zapier push --skip-npm-install to get round that error message.

 --skip-npm-install builds the zip directly from the current directory’s node_modules. It doesn’t run npm install with a clean slate, so you would install any private packages yourself into node_modules before running that command zapier push --skip-npm-install.