Open almostsultry opened 5 months ago
found the same error! were you able to figure it out?
Not yet. Hoping @adrianhajdin will chime in and assist. I'm sure it's going to be something stupidly simple that I've missed.
hey i have came acrossed same issue
@Gluchub how u do it?
@Gluchub how u do it?
bro i finally solved that issue actually loggedIn user data looks like this = [
{
all the information details
} ]. so while passing the id in the accounts variable in getAccounts function . you may need to create a new variable
for ex : user_id= loggedIn[0]['$id']
and pass that user_id to the getAccounts function.
once you are done also update the rightSideBar component and and pass loggedIn[0] instead of just loggedIn. same with headerBox loggedIn[0]?.firstname in user
loggedIn user on user.action file or waht?
@Gluchub how u do it?
bro i finally solved that issue actually loggedIn user data looks like this = [
{
all the information details
} ]. so while passing the id in the accounts variable in getAccounts function . you may need to create a new variable
for ex : user_id= loggedIn[0]['$id']
and pass that user_id to the getAccounts function.
once you are done also update the rightSideBar component and and pass loggedIn[0] instead of just loggedIn. same with headerBox loggedIn[0]?.firstname in user
I'm learning here, and I don't understand. Please provide more details as to where this is happening (file:line). I literally forked the code so I could setup my own backend services, so the code should've been fully baked; but you're saying it's broken?
still dont get answer btw
loggedIn user on user.action file or waht?
no bro loggedIn user in main page.tsx file. where you are calling getLoggedInUser function
@almostsultry actually let me explain this error Invalid query: Query value is invalid for attribute "$id'" so according to this error value of $id is getting undefined .
so here the problem is not occuring with our backend . i guess appwrite just changed its json format it is not directly deliverying whole set of object , but they packed it inside the array ..
so you have to modify your page.tsx file of main (root) directory,
on line 11 where we declared loggedIn user variable const loggedIn = await getLoggedInUser();
just add new variable under that variable
const user_id = loggedIn[0]['$id'];
and pass this user_id value to accounts
like this:
const accounts = await getAccounts({ userId: user_id })
once you are done update all components like rightsidebar
<RightSideBar user={loggedIn[0]} transactions={accounts.transactions} banks={accountsData?.slice(0,2)} />
but here instead of just loggedIn , pass loggedIn[0] to the user
import HeaderBox from '@/components/HeaderBox'
import RightSidebar from '@/components/RightSidebar';
import TotalBalanceBox from '@/components/TotalBalanceBox';
import { getAccount, getAccounts } from '@/lib/action/bank.actions';
import { getLoggedInUser } from '@/lib/action/user.actions';
import React from 'react'
const Home = async ({ searchParams: {id, page}}: SearchParamProps) => {
const loggedIn = await getLoggedInUser();
const user_id = loggedIn[0]['$id'];
const accounts = await getAccounts({
userId: user_id})
if(!accounts) return;
const accountsData = accounts?.data;
const appwriteItemId = (id as string) || accountsData[0]?.appwriteItemId;
const account = await getAccount({ appwriteItemId })
console.log({
accountsData,
account
})
return (
) }
export default Home`
@promumyhero can you provide me json details by console logging loggedIn variable because in my case it is working
@promumyhero here is my code it works in my case
import HeaderBox from '@/components/HeaderBox'; import RecentTransactions from '@/components/RecentTransactions'; import RightSideBar from '@/components/RightSideBar'; import TotalBalanceBox from '@/components/TotalBalanceBox'; import { getAccount, getAccounts } from '@/lib/actions/bank.actions'; import { getLoggedInUser } from '@/lib/actions/user.actions'; import { generateTransactions } from '@/lib/utils'; import React from 'react'
const Home = async ({ searchParams: { id, page } }: SearchParamProps) => { const currentPage = Number(page as string) || 1; const loggedIn = await getLoggedInUser(); const user_id = loggedIn[0]['$id']; const accounts = await getAccounts({ userId: user_id })
if(!accounts) return;
const accountsData = accounts?.data;
const appwriteItemId = (id as string) || accountsData[0]?.appwriteItemId;
const account = await getAccount({ appwriteItemId })
account.transactions = generateTransactions(15); return (
) }
export default Home;
@promumyhero or did you changed any function in user.actions.ts file?
@Gluchub I think the error that you solved is different than the bug that @almostsultry and @promumyhero have: they have no document written to their banks collection in Appwrite. Therefore, when using a function like getLoggedInUser
no documents can be returned, hence they get an empty array and no $id
attribute will be in there, and in the end you will get an error like
code: 400, type: 'general_query_invalid', response: { message: 'Invalid query: Query value is invalid for attribute "$id"', code: 400, type: 'general_query_invalid', version: '1.5.7' } } An error occurred while getting the account: TypeError: Cannot read properties of undefined (reading 'accessToken')
I am experiencing this error myself right now, using what is logged in the console when signing up a new user and using the Plaid interface. When closely examining that, I see that the Plaid request gives me the following:
data: { display_message: null, documentation_url: 'https://plaid.com/docs/?ref=error#invalid-request-errors', error_code: 'MISSING_FIELDS', error_message: 'the following required fields are missing: client_id, secret', error_type: 'INVALID_REQUEST', request_id: 'tLpT7jLiiSgNn5H', suggested_action: null }
I am quite sure I filled out the correct client_id
and secret
keys for my Plaid account... I will keep you guys up to date.
@MauritsBrinkman i guess you are right, so issue is with there database, bro even it takes too much time to display the bank details .
yeah you right i got this accesToken Error
AppwriteException: Invalid query: Query value is invalid for attribute "$id"
at _Client.call (webpack-internal:///(rsc)/./node_modules/node-appwrite/dist/client.mjs:283:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Databases.listDocuments (webpack-internal:///(rsc)/./node_modules/node-appwrite/dist/services/databases.mjs:1581:12)
at async $$ACTION_8 (webpack-internal:///(rsc)/./lib/action/user.actions.ts:243:22)
at async $$ACTION_1 (webpack-internal:///(rsc)/./lib/action/bank.actions.ts:77:22)
at async Home (webpack-internal:///(rsc)/./app/(root)/page.tsx:42:21) {
code: 400,
type: 'general_query_invalid',
response: {
message: 'Invalid query: Query value is invalid for attribute "$id"',
code: 400,
type: 'general_query_invalid',
version: '1.5.7'
}
}
An error occurred while getting the account: TypeError: Cannot read properties of undefined (reading 'accessToken')
at $$ACTION_1 (webpack-internal:///(rsc)/./lib/action/bank.actions.ts:82:32)
so my database is wrong or what?
nevermnd, my code works, my database is incorrect, LOL, Thanks @MauritsBrinkman
@promumyhero How was your database wrong? I know I’m missing something in Appwrite, but I can’t figure out what.
From: Ridho Hery Winarto @.> Sent: Tuesday, July 9, 2024 12:31:31 AM To: adrianhajdin/banking @.> Cc: Benjamin J. Rutledge @.>; Mention @.> Subject: Re: [adrianhajdin/banking] Error 400: 'Invalid query: Query value is invalid for attribute "$id"' (Issue #30)
nevermnd, my code works, my database is incorrect, LOL, Thanks @MauritsBrinkmanhttps://github.com/MauritsBrinkman
— Reply to this email directly, view it on GitHubhttps://github.com/adrianhajdin/banking/issues/30#issuecomment-2216491457, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABF4C6Y7242RGCQPM4HC7R3ZLNRSHAVCNFSM6AAAAABJ57ZFS2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJWGQ4TCNBVG4. You are receiving this because you were mentioned.Message ID: @.***>
@promumyhero @almostsultry So when a new user signs up, you should not only have a document for that under the users collection in the database, but when the bank is connected, there should also appear a document for the banks collection. Unless you have not entered the correct attributes or mistyped them in the database the problem should not be there: I think the most likely issue is that you've mistyped something in your plaid.ts
or appwrite.ts
configuration files. For me all works fine now after I found out I made an error in my Appwrite configuration file. Hope this helps.
@promumyhero @MauritsBrinkman @anayathawale @Gluchub @adrianhajdin
Maybe I should try asking my question a different way...
It doesn't make sense to me that the code is broken because just running a fork of his code with the built-in keys and IDs works just fine, so I assume it must be something I've missed setting up on the database side. I get documents in my Users collection, but none in my Banks collection after a successful completion of the Plaid pop-up process.
Here are screenshots of the attributes I have configured for each of my Collections in AppWrite. Please point to what I am missing or have misconfigured (assume all string lengths are exactly as specified in the video).
Banks:
Users:
Transactions:
Did you fixed this issue? having the same thing
@promumyhero @MauritsBrinkman @anayathawale @Gluchub @adrianhajdin
Maybe I should try asking my question a different way...
It doesn't make sense to me that the code is broken because just running a fork of his code with the built-in keys and IDs works just fine, so I assume it must be something I've missed setting up on the database side. I get documents in my Users collection, but none in my Banks collection after a successful completion of the Plaid pop-up process.
Here are screenshots of the attributes I have configured for each of my Collections in AppWrite. Please point to what I am missing or have misconfigured (assume all string lengths are exactly as specified in the video).
Banks:
Users:
Transactions:
Having the same porblem. Anybody has any solution what to do actually?
Anyone here can help with this issue? AppwriteException: Invalid query: Query value is invalid for attribute "$id" at _Client.call (webpack-internal:///(rsc)/./node_modules/node-appwrite/dist/client.mjs:283:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Databases.listDocuments (webpack-internal:///(rsc)/./node_modules/node-appwrite/dist/services/databases.mjs:1581:12) at async $$ACTION_8 (webpack-internal:///(rsc)/./lib/actions/user.actions.ts:239:22) at async $$ACTION_1 (webpack-internal:///(rsc)/./lib/actions/bank.actions.ts:77:22) at async Home (webpack-internal:///(rsc)/./app/(root)/page.tsx:40:21) { code: 400, type: 'general_query_invalid', response: { message: 'Invalid query: Query value is invalid for attribute "$id"', code: 400, type: 'general_query_invalid', version: '1.5.7' } } An error occurred while getting the account: TypeError: Cannot read properties of undefined (reading 'accessToken') at $$ACTION_1 (webpack-internal:///(rsc)/./lib/actions/bank.actions.ts:82:32) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Home (webpack-internal:///(rsc)/./app/(root)/page.tsx:40:21)
Hey guys, I have solved this issue. I have provided a video describing the problem and how to solve it. Make sure you have done everything mentioned in the YouTube video till 4:50:00, and then make the changes I show in my video. Also make sure to change "return parseStringify(bank.documents[0])" to "return parseStringify(bank)' which I forgot to mention in the video.
Here if the code for your reference: https://github.com/rayvego/jsm-banking-copy
Here is the recording: https://drive.google.com/file/d/1Ac4ca3gMCSLt3pnjhzoijiBAKvWefzGw/view?usp=sharing
P.S. Just to confirm, I am able to see correct bank details on the home page!
Hey guys, I have solved this issue. I have provided a video describing the problem and how to solve it. Make sure you have done everything mentioned in the YouTube video till 4:50:00, and then make the changes I show in my video. Also make sure to change "return parseStringify(bank.documents[0])" to "return parseStringify(bank)' which I forgot to mention in the video.
https://drive.google.com/file/d/1Ac4ca3gMCSLt3pnjhzoijiBAKvWefzGw/view?usp=sharing
P.S. Just to confirm, I am able to see correct bank details on the home page!
I really appreciate this but is there any way you can share your code? I did what the video said and still having issues.
AppwriteException: Missing required parameter: "documentId" at Databases.getDocument (webpack-internal:///(rsc)/./node_modules/node-appwrite/dist/services/databases.mjs:1656:13) at $$ACTION_8 (webpack-internal:///(rsc)/./lib/actions/user.actions.ts:239:37) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async $$ACTION_1 (webpack-internal:///(rsc)/./lib/actions/bank.actions.ts:78:22) at async Home (webpack-internal:///(rsc)/./app/(root)/page.tsx:43:21) { code: 0, type: '', response: '' } An error occurred while getting the account: TypeError: Cannot read properties of undefined (reading 'accessToken') at $$ACTION_1 (webpack-internal:///(rsc)/./lib/actions/bank.actions.ts:83:32) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Home (webpack-internal:///(rsc)/./app/(root)/page.tsx:43:21) { accountsData: [], account: undefined }
Yeah, totally, I'll share my code.
https://github.com/rayvego/jsm-banking-copy There you go! Let me know what was missing.
thank you so much i will check it out and let you know what i missed.
I looked at the code and i really do not see anything missing or different but for some reason still having an issue. Think im just going to give up and move on.
AppwriteException: Missing required parameter: "documentId" at Databases.getDocument (webpack-internal:///(rsc)/./node_modules/node-appwrite/dist/services/databases.mjs:1656:13) at $$ACTION_8 (webpack-internal:///(rsc)/./lib/actions/user.actions.ts:239:37) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async $$ACTION_1 (webpack-internal:///(rsc)/./lib/actions/bank.actions.ts:76:22) at async Home (webpack-internal:///(rsc)/./app/(root)/page.tsx:46:5) { code: 0, type: '', response: '' } An error occurred while getting the account: TypeError: Cannot read properties of undefined (reading 'accessToken') at $$ACTION_1 (webpack-internal:///(rsc)/./lib/actions/bank.actions.ts:81:32) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Home (webpack-internal:///(rsc)/./app/(root)/page.tsx:46:5)
missing appwrite 'documentId' not sure where is that my database looks fine.
@promumyhero @almostsultry So when a new user signs up, you should not only have a document for that under the users collection in the database, but when the bank is connected, there should also appear a document for the banks collection. Unless you have not entered the correct attributes or mistyped them in the database the problem should not be there: I think the most likely issue is that you've mistyped something in your
plaid.ts
orappwrite.ts
configuration files. For me all works fine now after I found out I made an error in my Appwrite configuration file. Hope this helps.
Thanks @MauritsBrinkman ! You are right.
@bustillos83 Error is AppwriteException: Invalid query: Query value is invalid for attribute "$id"
This means when we create new user, even after successful plaid integration, it does not create document in banks collection. Since no document is created, we receive the first error, stating invalid id/Missing required parameter: "documentId". if you troubleshoot this one successfully, there is no issue in access token. It will get resolved automatically.
In my case, in file bank.actions.ts, in getAccounts method, we declare const accounts
const account = { id: accountData.account_id, availableBalance: accountData.balances.available!, currentBalance: accountData.balances.current!, institutionId: institution.institution_id, name: accountData.name, officialName: accountData.official_name, mask: accountData.mask!, type: accountData.type as string, subtype: accountData.subtype! as string, appwriteItemId: bank.$id, sharableId: bank.sharableId, };
here, I found typo and fixed it. If you follow video, you create sharableId but when you copy/paste bank.actions.ts, it is shareableId. It creates problem. We fail to create account and hence eventually document. Just make sure, you follow same word in your code (all places even props) either sharableID or shareableId and in your appwrite database attribute. Then just create brand new user (sign up) and you will fetch accounts successfully.
I dont think the problem is about fetching, its about creating the document in first place.
@promumyhero @almostsultry So when a new user signs up, you should not only have a document for that under the users collection in the database, but when the bank is connected, there should also appear a document for the banks collection. Unless you have not entered the correct attributes or mistyped them in the database the problem should not be there: I think the most likely issue is that you've mistyped something in your
plaid.ts
orappwrite.ts
configuration files. For me all works fine now after I found out I made an error in my Appwrite configuration file. Hope this helps.Thanks @MauritsBrinkman ! You are right.
@bustillos83 Error is AppwriteException: Invalid query: Query value is invalid for attribute "$id"
This means when we create new user, even after successful plaid integration, it does not create document in banks collection. Since no document is created, we receive the first error, stating invalid id/Missing required parameter: "documentId". if you troubleshoot this one successfully, there is no issue in access token. It will get resolved automatically.
In my case, in file bank.actions.ts, in getAccounts method, we declare const accounts
const account = { id: accountData.account_id, availableBalance: accountData.balances.available!, currentBalance: accountData.balances.current!, institutionId: institution.institution_id, name: accountData.name, officialName: accountData.official_name, mask: accountData.mask!, type: accountData.type as string, subtype: accountData.subtype! as string, appwriteItemId: bank.$id, sharableId: bank.sharableId, };
here, I found typo and fixed it. If you follow video, you create sharableId but when you copy/paste bank.actions.ts, it is shareableId. It creates problem. We fail to create account and hence eventually document. Just make sure, you follow same word in your code (all places even props) either sharableID or shareableId and in your appwrite database attribute. Then just create brand new user (sign up) and you will fetch accounts successfully.
I dont think the problem is about fetching, its about creating the document in first place.
omg i had 2 instances of sharableId in my database once was called 'sharableId' and then the other 'shareableId', I deleted the one that was misspelled and now it works. Thank you so much i was about to give up.
I looked at the code and i really do not see anything missing or different but for some reason still having an issue. Think im just going to give up and move on.
AppwriteException: Missing required parameter: "documentId" at Databases.getDocument (webpack-internal:///(rsc)/./node_modules/node-appwrite/dist/services/databases.mjs:1656:13) at $$ACTION_8 (webpack-internal:///(rsc)/./lib/actions/user.actions.ts:239:37) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async $$ACTION_1 (webpack-internal:///(rsc)/./lib/actions/bank.actions.ts:76:22) at async Home (webpack-internal:///(rsc)/./app/(root)/page.tsx:46:5) { code: 0, type: '', response: '' } An error occurred while getting the account: TypeError: Cannot read properties of undefined (reading 'accessToken') at $$ACTION_1 (webpack-internal:///(rsc)/./lib/actions/bank.actions.ts:81:32) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Home (webpack-internal:///(rsc)/./app/(root)/page.tsx:46:5)
I am also having this issue; however, my database is the same and I am still getting the error? I've been stuck here for hours and I am not quite sure what it could be. I've tried all the solutions above with no end.
EDIT: The end I've reached is that documentId is null because (skipping the stack trace) in page.tsx the 'accounts' variable is returning a blank data array because getBanks() method is returning null. Within the getBanks() method: the 'banks' variable returns a total of 0 & an empty documents array. This appears to be because the query is not finding a userId because there is no such userId within the bank collection. I'm assuming the issue is Plaid/Dwolla is not writing to my database and I don't know why.
my issue was that i had sharableId and shareableId both in my database, I deleted the sharableId and then it worked.
my issue was that i had sharableId and shareableId both in my database, I deleted the sharableId and then it worked.
Unfortunately, this is not the issue. Every item in my database matches the reference within the code. Case-sensitive and everything.
Good morning, y'all.
I finally figured out my issue. Looking at the values being written to Appwrite from user.actions.ts:154-183, I saw another misspelled key in my banks collection. I had "fundingSource", but the file was trying to write to "fundingSourceUrl". I then:
It worked!!!
I made no code changes other than a find-and-replace of all the "sharableId" keys with "shareableId", including in the readme.md for completeness.
@anayathawale @soham7kulkarni @sarikamahboob @Admeen3581 @bustillos83 @Gluchub @rayvego @MauritsBrinkman @promumyhero
Thank you for the help. I still cannot find the error. No elements are mis-spelled, I checked them all. I mentally am drained over this bug. I've had it for about a week now. I'd applaud anyone who can undo my catastrophic error.
Note: I did not follow the tutorial directly. You'll see lots of similarities, but if I follow a tutorial word-for-word I do not learn (plus it will never feel like 'mine'). I added lots of additional elements and placed my own twist on it (probably the reason for the error). The database works as intended and works correctly, but it just cannot read any of the banking information for an unknown reason.
GitHub Link: https://github.com/Admeen3581/Youngin_Budgeting/tree/plaid
for database, dwolla, or plaid screenshots just @ me
Hi - would like to add to this in case it helps anyone out.
I had the same issue, however in my case, the issue for me was using a different country code (UK) as apposed to the tutorial video (US) therefore Plaid listing bank accounts for that country, connecting a different bank account all together. Not sure if it is down to the country code or the specific selection of banks that you may be connecting with via Plaid (not tested this thoroughly), but it seems like the creation of the bank account in the database collection (banks) does not work.
After ensuring that my database and code didn't have any typos for keys, e.g. the mentioned shareableId
from various users above, a clean database by deleting any users in Auth, and database collection (users). Re-signing up and using the same bank choice as the tutorial video, I was able to get a document in the banks collection and therefore displaying the data for it via the front end.
Hey guys, I have solved this issue. I have provided a video describing the problem and how to solve it. Make sure you have done everything mentioned in the YouTube video till 4:50:00, and then make the changes I show in my video. Also make sure to change "return parseStringify(bank.documents[0])" to "return parseStringify(bank)' which I forgot to mention in the video.
Here if the code for your reference: https://github.com/rayvego/jsm-banking-copy
Here is the recording: https://drive.google.com/file/d/1Ac4ca3gMCSLt3pnjhzoijiBAKvWefzGw/view?usp=sharing
P.S. Just to confirm, I am able to see correct bank details on the home page!
I had figured out the shareableId part, but I couldn't figure out the document part - well done!
AppwriteException [Error]: Invalid query: Query value is invalid for attribute "userId" at Client.call (webpack-internal:///(rsc)/./node_modules/node-appwrite/lib/client.js:206:15) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Databases.listDocuments (webpack-internal:///(rsc)/./node_modules/node-appwrite/lib/services/databases.js:1658:16) at async $$ACTION_7 (webpack-internal:///(rsc)/./lib/actions/user.actions.ts:230:23) at async $$ACTION_0 (webpack-internal:///(rsc)/./lib/actions/bank.actions.ts:31:23) at async Home (webpack-internal:///(rsc)/./app/(root)/page.tsx:38:22) { code: 400, type: 'general_query_invalid', response: { message: 'Invalid query: Query value is invalid for attribute "userId"', code: 400, type: 'general_query_invalid', version: '1.5.10' } }
An error occurred while getting the accounts: TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator)) at Function.all () at $$ACTION_0 (webpack-internal:///(rsc)/./lib/actions/bank.actions.ts:34:40) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Home (webpack-internal:///(rsc)/./app/(root)/page.tsx:38:22)
@Gluchub @rayvego @almostsultry i changed sharableId to shareableId, and did ensure everything is correct on appwrite still getting this error
AppwriteException: Invalid query: Query value is invalid for attribute "$id"
at _Client.call (webpack-internal:///(rsc)/./node_modules/node-appwrite/dist/client.mjs:283:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Databases.listDocuments (webpack-internal:///(rsc)/./node_modules/node-appwrite/dist/services/databases.mjs:1581:12)
at async $$ACTION_8 (webpack-internal:///(rsc)/./lib/actions/user.actions.ts:243:22)
at async $$ACTION_1 (webpack-internal:///(rsc)/./lib/actions/bank.actions.ts:77:22)
at async Home (webpack-internal:///(rsc)/./app/(root)/page.tsx:42:21) {
code: 400,
type: 'general_query_invalid',
response: {
message: 'Invalid query: Query value is invalid for attribute "$id"',
code: 400,
type: 'general_query_invalid',
version: '1.5.10'
}
}
An error occurred while getting the account: TypeError: Cannot read properties of undefined (reading 'accessToken')
at $$ACTION_1 (webpack-internal:///(rsc)/./lib/actions/bank.actions.ts:82:32)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Home (webpack-internal:///(rsc)/./app/(root)/page.tsx:42:21)
GET / 200 in 3363ms
95:5)
at async Home (webpack-internal:///(rsc)/./app/(root)/page.tsx:42:21)
95:5)
at async Home (webpack-internal:///(rsc)/./app/(root)/page.tsx:42:21)
GET / 200 in 3363ms
It's been 3 days, and I've done everything but am still getting this error. I checked every single file, the AUTH files, but still couldn't find the actual error. please help!!!
These are appwrite exceptions, you need to check to make sure you have these in your appwrite database.
If this helps anyone, I had the same error pop up because I wasn't passing the appwriteItemId
correctly to the getAccount
fn in the Home component (app/(root)/page.tsx
):
// My code (wrong)
const account = await getAccount(appwriteItemId);
// Correct code (pass item inside an object)
const account = await getAccount({appwriteItemId});
To make it easier to debug, I added console.log
statements for most server actions, including getAccount
, with the function name for both the function input and the logged error like so:
export const getBank = async ({documentId}: getBankProps) => {
try {
console.log('[getBank]', {documentId}); // <-- THIS
const {database} = await createAdminClient();
const bank = await database.listDocuments(
DATABASE_ID!,
BANK_COLLECTION_ID!,
[Query.equal('$id', [documentId])]
);
return parseStringify(bank.documents[0]);
} catch (error) {
console.log('[getBank] ERROR', error); // <-- THIS
}
};
After I made this fix I got the following error, because there were no attributes specified on the transactions
collection in AppWrite (don't think the video mentioned that yet):
AppwriteException: Invalid query: Attribute not found in schema: senderBankId
at _Client.call (webpack-internal:///(rsc)/./node_modules/node-appwrite/dist/client.mjs:283:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Databases.listDocuments (webpack-internal:///(rsc)/./node_modules/node-appwrite/dist/services/databases.mjs:1581:12)
at async $$ACTION_1 (webpack-internal:///(rsc)/./lib/actions/transaction.actions.ts:39:36)
at async $$ACTION_1 (webpack-internal:///(rsc)/./lib/actions/bank.actions.ts:93:42)
at async Home (webpack-internal:///(rsc)/./app/(root)/page.tsx:58:21) {
code: 400,
type: 'general_query_invalid',
response: {
message: 'Invalid query: Attribute not found in schema: senderBankId',
code: 400,
type: 'general_query_invalid',
version: '1.5.10'
}
}
It appears those attributes are later added in the tutorial, around 5:52:41.
After these 2 fixes (getAccount({appwriteItemId})
& adding the attributes to the transactions
collection in AppWrite) it all worked fine.
GUYSS HELP MEEE!!!!
⨯ app(root)\page.tsx (12:22) @ $id ⨯ TypeError: Cannot read properties of null (reading '$id') at Home (page.tsx:37:26) digest: "11398478" 10 | const loggedIn = await getLoggedInUser(); 11 | const accounts = await getAccounts({
12 | userId: loggedIn.$id | ^ 13 | }) 14 | 15 | if(!accounts) return;
Everything is working fine in my case....the problem is when i am console logging accountsData and the account....the account part is returning as undefined....therefore I am not able to pass account.transactions to the transaction property...Let me know if anyone has the same problem or anyone has already sorted this out
Error below. This comes after trying to add bank account(s). The Plaid interface succeeds, but there's no document written to the banks collection.
Feels like I'm missing a relationship or an attribute somewhere. Is there a set of screenshots for all the Appwrite collections and attributes? I can't find my error in the video.
An error occurred while getting the account: TypeError: Cannot read properties of undefined (reading 'accessToken') at $$ACTION_1 (webpack-internal:///(rsc)/./lib/actions/bank.actions.ts:82:32) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Home (webpack-internal:///(rsc)/./app/(root)/page.tsx:43:21) GET /?_rsc=3rnhc 200 in 1794ms POST / 200 in 89ms AppwriteException [Error]: Invalid query: Query value is invalid for attribute "$id" at Client.call (webpack-internal:///(rsc)/./node_modules/node-appwrite/lib/client.js:206:15) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Databases.listDocuments (webpack-internal:///(rsc)/./node_modules/node-appwrite/lib/services/databases.js:1658:16) at async $$ACTION_8 (webpack-internal:///(rsc)/./lib/actions/user.actions.ts:244:22) at async $$ACTION_1 (webpack-internal:///(rsc)/./lib/actions/bank.actions.ts:77:22) at async Home (webpack-internal:///(rsc)/./app/(root)/page.tsx:43:21) { code: 400, type: 'general_query_invalid', response: { message: 'Invalid query: Query value is invalid for attribute "$id"', code: 400, type: 'general_query_invalid', version: '1.5.7' } }