Skip to content
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

fix: New planetscale initialization #4226

Merged
merged 3 commits into from
Nov 14, 2023
Merged

fix: New planetscale initialization #4226

merged 3 commits into from
Nov 14, 2023

Conversation

SevInf
Copy link
Contributor

@SevInf SevInf commented Nov 10, 2023

@janpio
Copy link
Contributor

janpio commented Nov 10, 2023

Is it expected that this works right now?
Maybe because our tests are JS?

@Jolg42
Copy link
Contributor

Jolg42 commented Nov 10, 2023

Sounds like JS to me indeed.

Let's keep this PR open? I'm curious to see tests failing once we merge prisma/prisma#21883 and then this PR should fix them.

@SevInf
Copy link
Contributor Author

SevInf commented Nov 10, 2023

Is it expected that this works right now?
Maybe because our tests are JS?

Yes, programmatic interface of Client and Connection is almost identical, so without TS it just works.

@Jolg42
Copy link
Contributor

Jolg42 commented Nov 10, 2023

@SevInf
Copy link
Contributor Author

SevInf commented Nov 13, 2023

Turns out, driver-adapters don't update automatically, in current dev it is still at 5.5.2.

If I update it manually, I get a failure as expected:

 FAIL  ./index.test.js
  ● Test suite failed to run

    TypeError: PrismaPlanetScale must be initialized with an instance of Client:
    import { Client } from '@planetscale/database'
    const client = new Client({ url })
    const adapter = new PrismaPlanetScale(client)

@Jolg42
Copy link
Contributor

Jolg42 commented Nov 13, 2023

Update happened!

@Jolg42
Copy link
Contributor

Jolg42 commented Nov 13, 2023

Now failing as expected on main https://github.com/prisma/ecosystem-tests/actions/runs/6853648850/job/18635007879#step:8:214

FAIL ./index.test.js
  ● Test suite failed to run

    TypeError: PrismaPlanetScale must be initialized with an instance of Client:
    import { Client } from '@planetscale/database'
    const client = new Client({ url })
    const adapter = new PrismaPlanetScale(client)

       7 |
       8 | const connection = connect({ url: connectionString })
    >  9 | const adapter = new PrismaPlanetScale(connection)
         |                 ^
      10 | const prisma = new PrismaClient({ adapter })
      11 |
      12 | exports.handler = async () => {

      at new PrismaPlanetScale (node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@prisma/adapter-planetscale/dist/index.js:218:13)
      at Object.<anonymous> (index.js:9:17)
      at Object.require (index.test.js:3:21)

@Jolg42
Copy link
Contributor

Jolg42 commented Nov 13, 2023

@SevInf There is something weird with the lambda test, still failing in this PR
https://github.com/prisma/ecosystem-tests/blob/fix/planetscale-init/driver-adapters/planetscale-lambda-basic/index.test.js

https://github.com/prisma/ecosystem-tests/actions/runs/6853805528/job/18635586688?pr=4226#step:8:308

> [email protected] test /home/runner/work/ecosystem-tests/ecosystem-tests/driver-adapters/planetscale-lambda-basic
> jest index.test.js

  console.log
    new TextDecoder().decode(response.Payload) {"errorType":"TypeError","errorMessage":"PrismaPlanetScale must be initialized with an instance of Client:\nimport { Client } from '@planetscale/database'\nconst client = new Client({ url })\nconst adapter = new PrismaPlanetScale(client)\n","trace":["TypeError: PrismaPlanetScale must be initialized with an instance of Client:","import { Client } from '@planetscale/database'","const client = new Client({ url })","const adapter = new PrismaPlanetScale(client)","","    at new PrismaPlanetScale2 (/var/task/index.js:7814:17)","    at Object.<anonymous> (/var/task/index.js:7855:15)","    at Module._compile (node:internal/modules/cjs/loader:1256:14)","    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)","    at Module.load (node:internal/modules/cjs/loader:1119:32)","    at Module._load (node:internal/modules/cjs/loader:960:12)","    at Module.require (node:internal/modules/cjs/loader:1143:19)","    at require (node:internal/modules/cjs/helpers:119:18)","    at _tryRequireFile (file:///var/runtime/index.mjs:1002:37)","    at _tryRequire (file:///var/runtime/index.mjs:1052:25)"]}

      at Object.log (index.test.js:25:13)

@Jolg42 Jolg42 merged commit 436cde1 into dev Nov 14, 2023
45 checks passed
@Jolg42 Jolg42 deleted the fix/planetscale-init branch November 14, 2023 10:37
@Jolg42
Copy link
Contributor

Jolg42 commented Nov 14, 2023

And it's passing all the tests now ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants