Getting BufferArray error while trying to deploy via Fly
Here is the last few lines of the console logs i get... when i run wasp deploy fly deploy command
32 Replies
Hi @Killshot. 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, it seems you're encountering an error while trying to deploy your Wasp application to Fly.io. While I don't have specific information about a "BufferArray" error in the provided context, I can offer some general troubleshooting steps and insights based on similar deployment issues other users have faced.
1. First, ensure you're using the latest version of Wasp. Some deployment issues have been resolved in newer versions. You can check your version with
wasp version
and upgrade if necessary Wasp CLI Deployment Docs (https://wasp-lang.dev/docs/advanced/deployment/cli#deploying).
2. If you're encountering errors during the build process, it might be related to missing files or incorrect paths. Double-check that all necessary files are present in your project directory and that your folder structure is correct Discord Support Thread (https://discord.com/channels/686873244791210014/1223671727943319584).
3. Sometimes, deployment issues can be caused by environment variables not being set correctly. Ensure that all required environment variables are properly configured for your Fly.io deployment Wasp Env Vars Docs (https://wasp-lang.dev/docs/project/env-vars).
4. If the error persists, you might want to try deploying in steps instead of using the all-in-one command. This can help isolate where the issue is occurring:
Wasp CLI Deployment Docs (https://wasp-lang.dev/docs/advanced/deployment/cli#deploying)
5. Check the Fly.io dashboard for any additional error messages or logs that might provide more context about the deployment failure.
If none of these steps resolve your issue, you may need to provide more detailed information about the error, including the full error message and any relevant parts of your Wasp configuration. The Wasp community is generally helpful with troubleshooting deployment issues, so you might consider sharing more details in the Wasp Discord channel or opening an issue on the Wasp GitHub repository.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Killshot, 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?Hmm, looks like you have a type error. Do
wasp compile
and wasp build
work normally?yes i did run
wasp compile
and wasp build
and they both end up with compiled successfully and built successfully.
and i didn't make any changes in webhook.ts file under lemonsqueezy for this error to appear randomly.
so don't know what's the issue here.Mind sharing the project so I can look into it? I have a theory, but it's faster if I test it out myself š
Hey @sodic i was able to figure it out eventually,
I think the issue was with the wasp build command,
somehow it wasn't setting my env variables properly even though it was being run succesfully.
after doing it multiple times and tweaking around the middleware file of my VPS it finally worked.
Atleast that's the working theory for now, i can't say what actually worked.
What did you think might have been the issue? @sodic
Nevermind @Filip ,
I seem to have messed it up again, and as soon as i run npm run build inside the .wasp/build/web-app folder i get this Type Error --
> [email protected] build
> npm run validate-env && tsc && vite build
> [email protected] validate-env
> node -r dotenv/config ./scripts/validate-env.mjs
š Validating environment variables...
../../../src/payment/lemonSqueezy/webhook.ts:24:33 - error TS2345: Argument of type 'Buffer' is not assignable to parameter of type 'ArrayBufferView'.
Type 'Buffer' is not assignable to type 'Uint8Array<ArrayBufferLike> | DataView<ArrayBufferLike>'.
Type 'Buffer' is not assignable to type 'Uint8Array<ArrayBufferLike>'.
The types of 'slice(...).buffer' are incompatible between these types.
Type 'ArrayBufferLike' is not assignable to type 'ArrayBuffer'.
Type 'SharedArrayBuffer' is missing the following properties from type 'ArrayBuffer': resizable, resize, detached, transfer, transferToFixedLength
24 if (!crypto.timingSafeEqual(Buffer.from(signature, 'utf8'), digest)) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error in ../../../src/payment/lemonSqueezy/webhook.ts:24
If you don't mind i would like to dm you too with the project details....Sure, send it!
I have sent you DM
Thanks, I'll try to have a look today!
@kapa.ai
I am seeing this error after migrating from 0.14 to 0.15
Let me check the knowledge base for you again. One moment! :books:
----------------------
I apologize, but I don't have enough specific information in the provided knowledge sources about errors related to migrating from Wasp version 0.14 to 0.15. The documents don't contain details about this particular migration or any common issues that might arise during this process.
To better assist you, it would be helpful if you could provide more details about the specific error you're encountering. This could include:
1. The full error message you're seeing
2. The part of your application where the error occurs (e.g., during build, deployment, or runtime)
3. Any changes you made to your code during the migration process
Without these details, I can only offer general advice:
1. Check the Wasp documentation for any migration guides or breaking changes between versions 0.14 and 0.15.
2. Ensure that all your dependencies are updated to versions compatible with Wasp 0.15.
3. Review your project's configuration files to make sure they're compatible with the new version.
If you can provide more specific information about the error, I'd be happy to try and assist further based on any relevant information in the knowledge sources.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Killshot, 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?
@kapa.ai
Let me check the knowledge base for you again. One moment! :books:
Sorry @Killshot, 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?
@kapa.ai
what could be causing this issue?
../../../src/payment/lemonSqueezy/webhook.ts:24:33 - error TS2345: Argument of type 'Buffer' is not assignable to parameter of type 'ArrayBufferView'.
Type 'Buffer' is not assignable to type 'Uint8Array<ArrayBufferLike> | DataView<ArrayBufferLike>'.
Type 'Buffer' is not assignable to type 'Uint8Array<ArrayBufferLike>'.
The types of 'slice(...).buffer' are incompatible between these types.
Type 'ArrayBufferLike' is not assignable to type 'ArrayBuffer'.
Type 'SharedArrayBuffer' is missing the following properties from type 'ArrayBuffer': resizable, resize, detached, transfer, transferToFixedLength
24 if (!crypto.timingSafeEqual(Buffer.from(signature, 'utf8'), digest)) {
~~~~~~
Let me check the knowledge base for you again. One moment! :books:
----------------------
Based on the error message you've provided, it appears you're encountering a TypeScript type error related to Buffer usage. This kind of error can occur when there's a mismatch between the expected and actual types in your code. However, I don't have specific information about this particular error in the context of Wasp in the provided knowledge sources.
That being said, this error seems to be more related to TypeScript and Node.js rather than Wasp specifically. Here are a few general suggestions that might help:
1. Check your TypeScript version: Make sure you're using a compatible version of TypeScript with your current Wasp version. Sometimes, updating TypeScript can resolve type-related issues.
2. Review your
tsconfig.json
: Ensure your TypeScript configuration is correct and compatible with your Wasp version. As mentioned in this GitHub issue (https://github.com/wasp-lang/wasp/issues/1057), there have been discrepancies between tsconfig.json
files in the past, which could lead to incorrect error reporting.
3. Check for recent changes: If this error appeared after migrating or updating Wasp, it's possible that there have been changes in type definitions or how Buffer is handled.
4. Use wasp clean
: As suggested in a Discord support thread (https://discord.com/channels/686873244791210014/1215750573278629958), running wasp clean
and then wasp start
can sometimes resolve issues by reinstalling and recompiling everything.
5. Verify your import statements: Make sure you're importing crypto
and Buffer
correctly in your code.
If the issue persists after trying these steps, you might want to reach out to the Wasp community on Discord or open an issue on the Wasp GitHub repository with more details about your project setup and the full context of the code where this error occurs.
Remember, when dealing with type errors, it's often helpful to review the TypeScript documentation for the specific APIs you're using, in this case, crypto.timingSafeEqual()
and Buffer
.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Killshot, 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?@kapa.ai
How do i solve this error?
~~~~~~
Found 1 error in ../../../src/payment/lemonSqueezy/webhook.ts:24
[email protected] build npm run validate-env && tsc && vite build
[email protected] validate-env node -r dotenv/config ./scripts/validate-env.mjsš Validating environment variables... ../../../src/payment/lemonSqueezy/webhook.ts:24:33 - error TS2345: Argument of type 'Buffer' is not assignable to parameter of type 'ArrayBufferView'. Type 'Buffer' is not assignable to type 'Uint8Array<ArrayBufferLike> | DataView<ArrayBufferLike>'. Type 'Buffer' is not assignable to type 'Uint8Array<ArrayBufferLike>'. The types of 'slice(...).buffer' are incompatible between these types. Type 'ArrayBufferLike' is not assignable to type 'ArrayBuffer'. Type 'SharedArrayBuffer' is missing the following properties from type 'ArrayBuffer': resizable, resize, detached, transfer, transferToFixedLength 24 if (!crypto.timingSafeEqual(Buffer.from(signature, 'utf8'), digest)) {
Let me check the knowledge base for you again. One moment! :books:
----------------------
This error appears to be a TypeScript compilation issue related to the usage of
Buffer
and crypto.timingSafeEqual()
in your Wasp project. Based on the information available in the knowledge sources, I can provide some general suggestions to help resolve this issue:
1. Update Wasp and dependencies: Ensure you're using the latest version of Wasp and its dependencies. Some issues have been resolved in newer versions. You can check your Wasp version with wasp version
and update if necessary Discord Support Thread (https://discord.com/channels/686873244791210014/1212533517360177253).
2. TypeScript configuration: Review your tsconfig.json
file. There have been discrepancies between tsconfig.json
files in the past, which could lead to incorrect error reporting GitHub Issue (https://github.com/wasp-lang/wasp/issues/1057).
3. Clean and rebuild: Try running wasp clean
to remove all generated files and dependencies, then rebuild your project with wasp start
. This can sometimes resolve issues by reinstalling and recompiling everything Discord Support Thread (https://discord.com/channels/686873244791210014/1215750573278629958).
4. Check Node.js version: Ensure you're using a compatible Node.js version. Some Wasp users have reported issues with Node.js 20, so you might want to try Node.js 18 if you're not already using it Discord Support Thread (https://discord.com/channels/686873244791210014/1212533517360177253).
5. Modify the code: If the above steps don't work, you might need to modify your code to use a different method for comparison or cast the Buffer to the expected type. However, without seeing more of your code, it's difficult to provide a specific solution.
If these steps don't resolve the issue, you may need to seek further assistance from the Wasp community. Consider sharing more details about your project setup and the full context of the code where this error occurs in the Wasp Discord channel or by opening an issue on the Wasp GitHub repository.
Remember, when dealing with type errors, it's often helpful to review the TypeScript documentation for the specific APIs you're using, in this case, crypto.timingSafeEqual()
and Buffer
.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Killshot, 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?@Killshot we updated react-router, I believe that is the issue here! I do think however that in our migration insturcitons we gave adviceo n how to handle tihs?
Also, I would suggest you open new Question when you have a new thing, it is easier for us to see what it is about and track it that way.
I did run
npm i react-router-dom
but no luck@Killshot you shouldn't have had to run that -> why would you run it, I don't think our instructions mention doing that?
Have you tried following migration instructions strictly?
I was instructed by sodic,
And yeah migration did bring some issues but i was able to solve them all and i am again back at this Type error Buffer issue in webhook.ts file of LemonSqueezy
Yea i did go step by step as mentioned in the Migration Guide
Hm, maybe I am missing too much context here, I thought it is a fresh issue, but if it is a continuation on the conversation so far, I willl let @Filip continue.
No no, @martinsos I sent @Killshot to you since I won't get a chance to take a look before Monday. š
There's no more context here, I believe you have evertyhing. I just didn't have the time to do a repro and have a proper look
Faced it few days ago yeah...
And until then i hadn't migrated to 0.15.
But wanted to see if i could solve this by updating to 0.15 and that didn't solve it.
Ah ok got it! In that case, I will make sure to take some proper time tomorrow to go thoroughly through this. If there is anything you pplz might want to summarize for me, for a faster start, that might help, if not I will just read through everything.
p.s. I don't see you pinging me for this issue @Filip though, I stumbled onto it while chekcing recent issues, might it be there is some kind of mix up? I will take it over anyway, just want to make sure there isn't another issue potentially.
No no, this is it š
I had just told @Killshot to tag you moments before you responded here
Ok, so I took a look at the conversation so far.
If I got it right, you solved the issue with react router, and we are now focusing on the initial problem, with the Buffer TS error?
You said you get the error when you do
npm run build
inside of .wasp/build/web-app
, after you run wasp build
? And I see that error seems to be reported from the lemon-squeezy webhook. That is weird, because that webhook is a server file, and you get error while trying to build client code. Is it possible that somewhere in your client code you by accident imported something from lemonSqueezy/webhook.ts?
As for the error itself, it complains that crypto.timingSafeEqual(Buffer.from(signature, 'utf8'), digest)
got Buffer instead of Uint8Array<ArrayBufferLike>
. Now why would crypto.timingSafeEqual
be not happy about the type in your case? Does something affect the type of it? Or maybe the type of what Buffer.from
produces? Maybe it definition of the function is different in client if you imported server code into client (although I would expect it not even get this far regarding compiler), or maybe you have some werid node version -> what is your node version?
TLDR:
- are you by accident importaing lemonSqueezy/webhook.ts into client code?
- what is your node version?
@Vinny (@Wasp) have you encountered anything like this?
@Filip could this be caused by strict: true
in tsconfig.json?my node version is v20.17.0
And to the best of my knowledge i don't remember importing webhook.ts code or lemonsqueezy onto the client side.
Also the thing is it lets me do
wasp compile
and wasp build
in the project directory and never shows any issue.
I only encountered this when i was trying to deploy this project on my VPS
I haven't even made any changes to the webhook.ts file and still faced this issue.
@martinsos any suggestions?- node version is 20 -> ok, that sounds all right.
- you can't remember importing webhook.ts in your client code -> ok, that said, can you 100% confirm you are not doing this? Can you check the code, search for any import of webhook potentially? To be sure this is indeed so.
- yeah, so it let's you do
wasp compile
and wasp build
, but it fails when you are doing wasp run build
inside of a .wasp/build/web-app
, correct? You said it happens when you try to deploy it to VPS -> but specifically, it happens when you run wasp run build
, right? And that is why I am asking if you are importing it in client code, because wasp run build
from web-app
runs only client code, so I am confused as to how it happens that TS complains about that file which is a server file.i am pretty sure regarding first 2 points.
and yes it happens when i run npm run build inside the
.wasp/build/web-app
folder.
The reason i do this is because it's mentioned in the VPS deployment guide.
https://gist.github.com/infomiho/80f3f50346566e39db56c5e57fefa1fe - Step 12 in this guide.
when this failed in the VPS i came back to local directory and ran the same command and here we are.
it's giving same error in both places.Gist
Deploy Wasp to a VPS (reverse proxy + Docker)
Deploy Wasp to a VPS (reverse proxy + Docker). GitHub Gist: instantly share code, notes, and snippets.
Also you are right, it freaked me out to a little too as to how it's showing a client side error...
Wohooo @Killshot, you just became a Waspeteer level 8!
They was a mismatch in typescript versions or maybe missing dependency, but it wasn't giving me a standard version error as usual and giving the above mentioned Type Buffer error,
i compared package json files of wasp repo and my local one and came to this solution.
Did
wasp compile
and wasp build
in the project directory the inside the package.json file i edited the typescript version manually and then ran npm install
and that fixed the issue of type buffer array and let me built the project via npm run build
ā
Fixed for now.