W
Waspβ€’2w ago
mm

Error when I installed puppeteer and turndown

The client doesn't start when I installed "puppeteer": "^24.2.0", and "turndown": "^7.2.0",. I think it's because of the sub dependency. agent-base and proxy-agent.
No description
20 Replies
kapa.ai
kapa.aiβ€’2w ago
Hi @mm. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the information provided in the knowledge sources, I don't have enough specific details to directly address your error with puppeteer and turndown. However, I can provide some general insights about dependency management in Wasp that might be helpful: 1. Wasp has a specific way of handling dependencies. As mentioned in Github Issue 1597, Wasp projects now have a top-level package.json and node_modules. 2. When adding new dependencies, you should be careful about potential conflicts. As noted in Github Issue 1859, Wasp consolidates user dependencies with framework dependencies, and there can be version conflicts. 3. If you're experiencing issues after adding new dependencies, you might need to restart the Wasp development server. As discussed in Github Issue 269, changes in dependencies might require restarting wasp start or running npm install automatically. 4. Make sure you're not adding these dependencies directly to the generated package.json files. Instead, you should add them to your project's root package.json or use the dependencies field in your .wasp file. 5. If the problem persists, you might want to check for any version conflicts between these new dependencies and Wasp's existing dependencies. To get more specific help, you might want to share the exact error message you're seeing when the client doesn't start. Also, consider sharing your .wasp file and root package.json content with the Wasp community for more targeted assistance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @mm, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
mm
mmOPβ€’2w ago
upon narrowing it down puppeteer is causing it. found this github issue as well https://github.com/puppeteer/puppeteer/issues/11881
GitHub
[Bug]: Class extends value undefined is not a constructor or null w...
Minimal, reproducible example import puppeteer from 'puppeteer' (async () => { // Launch the browser const browser = await puppeteer.launch(); // Create a page const page = await browser...
Vinny (@Wasp)
Vinny (@Wasp)β€’2w ago
awesome! thanks for the follow-up.
mm
mmOPβ€’7d ago
Np. I haven't fixed it yet tho. I really need puppeteer for this project. seems like a compilation issue it says when you build with vite? not sure
Vinny (@Wasp)
Vinny (@Wasp)β€’7d ago
ts errors are always a job for @Filip
Filip
Filipβ€’7d ago
@mm I think you're probably importing server-side code (puppeteer) in client files (code that ends up on the frontend). Could you double check that?
mm
mmOPβ€’6d ago
Hi @Filip the puppeteer is imported in a utility. here are the files that uses it. everything seems to be server side?
No description
miho
mihoβ€’4d ago
Are you importing something that is importing pupeteer? πŸ˜„ If the error is reported in the browser console, it must be imported somewhere on the client
Filip
Filipβ€’4d ago
@mm If you don't mind sharing the project in a zip, we can help you out
mm
mmOPβ€’4d ago
yes @miho I created a separate util that utilizes puppeteer and export it from utils so that I only import from utils.ts @miho @Filip is it okay to use puppeteer or any server side package under app/src/server/utils.ts?
Filip
Filipβ€’4d ago
Yes, but it seems you're importing it on the client somehow Do you mind sharing the project so I can dig in?
mm
mmOPβ€’4d ago
wait I just created a new project
Filip
Filipβ€’4d ago
Ok, perfect, if you could create a minimal reproduction, that's even better! πŸ˜„
mm
mmOPβ€’4d ago
Here @Filip I just created a util in app/src/server/utils.ts using puppeteer https://github.com/medardm/test-waspsaas
GitHub
GitHub - medardm/test-waspsaas
Contribute to medardm/test-waspsaas development by creating an account on GitHub.
Filip
Filipβ€’4d ago
Hm, seems like you're imporint puppeteer into payment/plans, which are used in client components. I think that's the proble Yes, that's definitely the problem πŸ™‚ Nice work spotting this, it's a mistake on our part (since some of these utils end up being used on the frontend, but the file's name server/utils implies otherwise) @Vinny (@Wasp) One for you here, did I get it right?
mm
mmOPβ€’3d ago
I see for temp solution should I move requireNodeEnvVar from server/utils then @Filip ? and import it separately. or move it to like client/utils
Vinny (@Wasp)
Vinny (@Wasp)β€’3d ago
move the pupeteer function to it's own file, something like server/puppeteer.ts and try importing into your serverside functions that way. Let me know if that works.
MEE6
MEE6β€’3d ago
Wohooo @Vinny (@Wasp), you just became a Waspeteer level 47!
Vinny (@Wasp)
Vinny (@Wasp)β€’3d ago
yeah it looks like that's what's happening. I made an issue for it here: https://github.com/wasp-lang/open-saas/issues/370
GitHub
organize server/utils.ts functions so that they aren't being impo...
We're importing requireNodeEnvVar into the payment/plans.ts and then some of these variables are being imported onto the client, causing clientside errors if the user extends the utils.ts file ...
mm
mmOPβ€’2d ago
thanks @Vinny (@Wasp) I will assess since maybe moving requirenodeenv will be easier for me since many of the utils exported from server/utils makes use of the puppeteer. Will let you know which one works

Did you find this page helpful?