-
Notifications
You must be signed in to change notification settings - Fork 911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG]: Creating Buffer in code piece cause "Invalid or Unexpected Token" error #4404
Comments
Hello @noahcastor , If you are using API token for NocoDB, then pass token in headers with key 'xc-token'. |
Thanks for the reply. Looking at their documentation though, it appears that they want us to use the account authorization token with the 'xc-auth' header parameter. The issue I mentioned before though occurs without even making the POST request with axios. It's the line above the first comment line that is causing the issue. I tried to execute Buffer.from() with both the blobFile and the arrayBuffer, but neither worked. |
Hi @noahcastor I think it's related to the code snippet and not to activepieces, I am closing this issue as it's not related. I reopened the topic in https://community.activepieces.com/t/how-do-i-convert-base64-image-to-a-temporary-file/3813 It's more appropriate there. Thank you, |
|
I've been trying to find a way to upload an image to NocoDB using the code piece for the past 3 days but have failed tremendously. I'm trying to use the QRCode npm package to generate qr codes, but the package returns the image in base64. I was having issues with sending a POST request to the API so I figured it was an issue with the image being in base64.
After some research, I notice some people converting the base64 into a blob, then the blob to a buffer before sending a post request with axios. When I attempt to convert the blob to a buffer, it causes an "Invalid or unexpected token" syntax error. Commenting out the line where I convert the "arrayBuffer" variable to a Buffer removes the error.
CODE:
ERROR:
{"stack":"/usr/src/app/dist/packages/server/api/sandbox/0/codes/step_4/index.js:2\n throw new Error('Compilation Error:\n ^^^^^^^^^^^^^^^^^^^\n\nSyntaxError: Invalid or unexpected token\n at internalCompileFunction (node:internal/vm:73:18)\n at wrapSafe (node:internal/modules/cjs/loader:1274:20)\n at Module._compile (node:internal/modules/cjs/loader:1320:27)\n at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)\n at Module.load (node:internal/modules/cjs/loader:1197:32)\n at Module._load (node:internal/modules/cjs/loader:1013:12)\n at Module.require (node:internal/modules/cjs/loader:1225:19)\n at require (node:internal/modules/helpers:177:18)\n at (webpack://activepieces/engine/src/lib/handler/code-executor.ts:41:65)","message":"Invalid or unexpected token"}
The text was updated successfully, but these errors were encountered: