#NFT scanning /users directory causing build failures with Netlify and Vercel adapters

1 messages · Page 1 of 1 (latest)

loud ibex
#

We're experiencing an issue where the Netlify and Vercel adapters fail when running builds locally with @clerk/astro. The problem occurs because @vercel/nft (present in both adapters) scans the /Users directory (where my app is located), which fails due to permission issues.

Details:

  1. We have a hardcoded /users string inside @clerk/backend (as the base URL for the API) - https://github.com/clerk/javascript/blob/95ac67a143c263bef0c1f589728566ab8f95768d/packages/backend/src/api/endpoints/UserApi.ts#L10
  2. NFT interprets this as a directory to scan.
  3. The error occurs in this file: https://github.com/withastro/adapters/blob/8274001d0d1a857e633f456c5f0ff1d469d4b6e4/packages/netlify/src/lib/nft.ts#L38

Temporary workaround:

  1. When installing @clerk/astro, installing the @clerk/backend dependency too. (For some reason, NFT skips /Users/** directory when you actually have the dependency installed)

Continuation of https://discord.com/channels/830184174198718474/1281005220431790203

loud ibex
#

Interestingly, the bug was fixed when using npm instead of pnpm

It works when you reinstall dependencies with shamefully-hoist set to true:

pnpm i --shamefully-hoist=true
humble comet
#

That is quite interesting. I havent used that package yet.

#

The @clerk/astro one that is

loud ibex
#

Now since @clerk/backend is not present inside node_modules, NFT thinks "/users" is a path and scans it

#

but it's not advisable to install via shamefully-hoist

loud ibex
humble comet
#

Do it. I don’t think it would really interfere with anything?

tight goblet
#

I appreciate the help with this issue. I trust that you are both smarter than me in resolving this.

For this advice: #1278796261033771041 message
is it 1 AND 2 or 1 OR 2?
(The "not recommended" comment is confusing me.)

Also, if the Clerk Backend adds support for the /users path, shouldn't that be documented? Because then I wouldn't want to have my own /users path that could conflict with it, right?

tight goblet
#

I just added this line to .npmrc and it seemed to build successfully:

public-hoist-pattern[]=*@clerk/*
#

(Also note that after modifying .npmrc, I trashed node_modules and ran pnpm install.)

#

The following line also works:

public-hoist-pattern[]=*@clerk/backend