I was mistaken a [previous fix](https://github.com/better-auth/better-auth/commit/452069aed976f3f06bd3f94d0d51cc74449ad9e3), it just moved the error.
This value should be the default model name to match [transformInput](https://github.com/better-auth/better-auth/blob/76c90f2e59b99c6d84b30ca0d3bc82cc0644ef2f/packages/better-auth/src/adapters/create-adapter/index.ts#L324) schema lookup.
The schema looks like this
```
{
...
rateLimit: {
modelName: 'rateLimits',
fields: {
key: [Object],
count: [Object],
lastRequest: [Object],
id: [Object]
}
}
}
```
Matching on the default name returns the correct schema.
This test is now passing locally a different rateLimiter model.
```
it ( "should hit rate limit on forth login attempt within 10s", async () => {
for ( let i = 0; i < 3; i++ ) {
const response = await request( testApp )
.post( usernameSignInPath )
.send( { username: testUsername, password: testPassword } );
expect( response.statusCode ).toEqual( 200 );
}
const res = await request( testApp )
.post( usernameSignInPath )
.send( { username: testUsername, password: testPassword } );
expect( res.statusCode ).toEqual( 429 );
expect( res.headers ).toHaveProperty( "x-retry-after" );
} );
```
The `set` function of `createDbStorage` is referencing a hardcoded string 'rateLimit'. This causes an error when a custom name for the model has been used:
```
TypeError: Cannot read properties of undefined (reading 'fields')
```
It should use the model the `get` method uses which reads `modelName` if it has been specified.
This change fixes the error locally for me.
* update(org): additional fields improvements
Fix: type error in client plugin auth generic
update: improved change-logs blog
* fix: teams still inferred
* update: changelog
* feat: first draft of SIWE plugin
* fix: run biome linter
* refactor(siwe): rename publicKey to walletAddress for clarity
- Add ensName as an optional param from the client
- Add emailDomainName to plugin options - fallback to getOrigin()
- Move schema to a separate file
* fix(siwe): update emailDomainName assignment to use nullish coalescing operator
* run biome linter
* fix(siwe): avatar field is not included in createUser call
* refactor(siwe): remove siwe dependency and implement nonce generation and message verification through plugin options
- Removed direct dependency on 'siwe' package.
- Introduced 'generateSiweNonce' and 'verifySiweMessage' as user functions
- Updated tests to reflect changes in nonce handling and message verification logic (WIP)
* feat: add anonymous flag to plugin options
* refactor(siwe): improve test coverage - anonymous flag, missing nonce & other edge cases
* feat(siwe): add checksum address validation using keccak256 + test case
* fix(siwe): refactor hashing utility to use @noble/hashes
* feat(siwe): enhance SIWE plugin with chainId support, strong typing, dedicated table for wallet adresses and more test coverage
* refactor(siwe): remove unused SIWE interfaces
* fix(siwe): PR review issues
* fix(siwe): rename const "siweClientPlugin" to "siweClient" for simplicity
* feat(siwe): add docs
* chore: fix lock file
* fix: account linking & code formatting
* run pnpm lint
---------
Co-authored-by: Bereket Engida <Bekacru@gmail.com>
* fix: bearer override headers
* fix: onSuccess called from global authClient
* clean up
* maken the default global onSuccess a plugin instead
* chore: revert disable default fetch plugins
* lint
* remove onsuccess call
* revert to the hook plugin
* lint
---------
Co-authored-by: Bereket Engida <bekacru@gmail.com>
* refactor: Pass both building and getRequestEvent from outside of library
- Removes the need for importing from virtual modules at the expense of more user boilerplate
* chore: add Svelte and related dependencies to externals
* chore: lint
* refactor(docs): update SvelteKit integration docs with new building and getRequestEvent usage
* feat: add an option to encrypt tokens by default
* feat(auth): add OAuth token encryption support
* refactor(auth): streamline token handling in OAuth callback by utilizing setTokenUtil
* refactor(auth): replace direct token handling with setTokenUtil for improved clarity and maintainability
* refactor(auth): unify token handling by utilizing setTokenUtil for access and refresh tokens
* docs(auth): enhance documentation for OAuth token encryption, clarifying security risks and benefits
* chore: cleanup
* update test