deep-foundation / deeplinks

https://discord.gg/deep-foundation
The Unlicense
14 stars 9 forks source link

Unable to login #311

Open FreePhoenix888 opened 9 months ago

FreePhoenix888 commented 9 months ago

Code Snippet

https://github.com/FreePhoenix888/deeplinks-login-error-example/blob/4c54875189621d8ff31b1934fde4ea93e35f4235/test.js#L30-L33

Output

{
  newUserLoginResultBeforeJoin: { linkId: null, token: null, error: 'unexepted' }
}

Expected result

To login without a problem because this code is copied from the test that is currently working https://github.com/deep-foundation/deeplinks/blob/427e40603a99bc658f69d52ed9efef340362aa86/tests/permissions.ts#L1132-L1171 But for some reasons it does not work outside of deeplinks

Actual result

gitpod /workspace/dev/temp/bug (main) $ npx --yes tsx test.js
{
  adminLogin: {
    linkId: 380,
    token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwczovL2hhc3VyYS5pby9qd3QvY2xhaW1zIjp7IngtaGFzdXJhLWFsbG93ZWQtcm9sZXMiOlsiYWRtaW4iXSwieC1oYXN1cmEtZGVmYXVsdC1yb2xlIjoiYWRtaW4iLCJ4LWhhc3VyYS11c2VyLWlkIjoiMzgwIn0sImlhdCI6MTcwODA2OTgwOH0.-fpP3Ijev5Zo9zFFqLi9BnueLvynk44Qjlx-rCJhNfY',
    error: undefined
  }
}
{
  newUserLoginResultBeforeJoin: { linkId: null, token: null, error: 'unexepted' }
}
{ joinInsertData: { type_id: 66, from_id: 1433, to_id: 380 } }
{ joinInsertResult: { data: [ [Object] ] } }
{
  newUserLoginResultAfterJoin: { linkId: null, token: null, error: 'unexepted' }
}
/workspace/dev/temp/bug/node_modules/@deep-foundation/deeplinks/imports/client.js:300
                throw new Error('token for apolloClient is invalid or not provided');
                      ^

Error: token for apolloClient is invalid or not provided
    at DeepClient (/workspace/dev/temp/bug/node_modules/@deep-foundation/deeplinks/imports/client.js:300:23)
    at main (/workspace/dev/temp/bug/test.js:47:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v18.17.1

Additional Info

Note that I use the latest deeplinks versions that is used for testing too

How to reproduce

git clone https://github.com/FreePhoenix888/deeplinks-login-error-example
cd deeplinks-login-error-example
npm install
npx --yes tsx test.js