#Error building after adding Vercel serverless adapter

30 messages · Page 1 of 1 (latest)

distant glade
#

Running npm run build I now see the following in the logs

08:03:08 AM [build] Waiting for the @astrojs/vercel/serverless integration...
[@astrojs/vercel] The module "stream/web" inside the file "C:\Users\rever\Documents\Projects\minbedrift-app\node_modules\@prisma\client\runtime\index.js" couldn't be resolved. This may not be a problem, but it's worth checking.
[@astrojs/vercel] The module "util/types" inside the file "C:\Users\rever\Documents\Projects\minbedrift-app\node_modules\@prisma\client\runtime\index.js" couldn't be resolved. This may not be a problem, but it's worth checking.
 error   Failed to parse C:\Users\rever\Documents\Projects\minbedrift-app\node_modules\@mapbox\node-pre-gyp\lib\util\nw-pre-gyp\index.html as script:
  Unexpected token (1:0)
  File:
    Error
  Stacktrace:
Error: Failed to parse C:\Users\rever\Documents\Projects\minbedrift-app\node_modules\@mapbox\node-pre-gyp\lib\util\nw-pre-gyp\index.html as script:
Unexpected token (1:0)

This happens both locally on Windows, but also when Vercel is building.

Config looks like this:

import { defineConfig } from 'astro/config';
import vue from '@astrojs/vue';
// import node from '@astrojs/node';
import vercel from '@astrojs/vercel/serverless';

import tailwind from '@astrojs/tailwind';

export default defineConfig({
  integrations: [vue(), tailwind()],
  output: 'server',
  adapter: vercel(),
});
distant glade
#

The build works if I just remove that nw-pre-gyp folder containing index.html from node_modules

Seems like part of the vercel/serverless integration scans all package.json files it can find?

#

Seems related to bcrypt package being used

#

Solved: Must use bcryptjs instead

#

It would be nice with a better error message around this

opaque kite
#

This Serverless Function has crashed. This is the error I get, do you have a clue

near acorn
#

Getting the same error here too

#

@distant glade Did you find a way to fix this? How did you force vercel to use bcryptjs?

near acorn
#

Maybe <@&882699029706862602> can help us more

opaque radish
#

just install the package ?
and switch it with normal bcrpyt ?

#

I am not sure it is the solution here

near acorn
opaque radish
#

umm
I meant the code

#

code are not same
like
bcrpyt-js used like
hashsync

near acorn
#

I can't get what you mean, there's no use of bcrypt in my website except for maybe a dependency using it.
What i did was:

  • Use astrowind template
  • Added vercel integration and swtiched to server output
opaque radish
#

I am confused then

near acorn
#

This is the file it's trying to parse:
node_modules/.pnpm/@mapbox+node-pre-gyp@1.0.10/node_modules/@mapbox/node-pre-gyp/lib/util/nw-pre-gyp/index.html

#

Thrown by: @vercel/nft/out/analyze.js:250:30

#

Might be an error of the @vercel/nft library being incorrectly thrown by astro and therefore breaking the build

near acorn
sharp cradle
#

Hey @near acorn Ive asked our resident in chief @timid hedge if he could take a look at this PR and issue that you have raised, interesting to see if and when vercel does get this fixed ( @autumn meadow )

distant glade
#

As I understand that bcrypt package was not compatible with serverless