revmischa

revmischa

Open source developer @JetBridge @Developer-DAO

Member Since 12 years ago

@jetbridge , Berkeley, CA

Experience Points
236
follower
Lessons Completed
106
follow
Lessons Completed
199
stars
Best Reply Awards
160
repos

677 contributions in the last year

Pinned
⚡ projectM - cross-platform music visualization. Open-source and Milkdrop-compatible
⚡ Slides and videos of talks I've given
⚡ Opinionated Flask serverless starter kit
⚡ TypeScript / Serverless / CDK application template
⚡ IP camera surveillance management system using AWS IoT with support for Axis cameras.
⚡ Cloud-native TypeScript API development kit for AWS CDK.
Activity
Apr
28
2 weeks ago
Activity icon
issue

revmischa issue comment prisma/prisma

revmischa
revmischa

Prisma Migrate: programmatic access to CLI commands (deploy, reset...)

Problem

It would be nice to have a way to run the migrate programmatically. I am running into an issue where my api is using lambdas (serverless) and my database is only accessible from within an aws vpc. Because of this I cannot "execute commands" on deploy in an easy way. My current solution is to ssh into an ec2 that is within the vpc, execute the prisma commands, and then spin the ec2 back down. While this is working, it is far from ideal. If I was instead able to have a separate lambda that had all the migration data bundled with it I could execute the migration from a lambda (that is within the vpc).

While this may seem like a specialized use case, databases that are not publicly accessible are common place, and solutions for migration that don't include running npm commands from the cli I think become critical.

Solution

import {migrate} from '@prisma/cli';
migrate('up');

Alternatives

Stated above, no great alternatives for common usecases.

revmischa
revmischa

Hi @jonasgroendahl I'm one of the authors of aws-samples/prisma-lambda-cdk repo and I recently found that it's much simpler and reproducible to use Docker Lambda for bundling a Lambda function with Prisma than zip bundling. It has less dependency on CDK (basically we just use Docker Lambda, not NodejsFunction construct) so it should be easy to rewrite with Pulumi.

I just published a Serverless Stack (CDK-based tool) + Prisma + Lambda sample repo here https://github.com/jetbridge/sst-prisma

It handles migrations with the SST Script construct which is a custom CF resource that can be run on create/update, it runs my prisma migrations automatically when doing a CDK deploy.

open pull request

revmischa wants to merge Developer-DAO/code-claim-site

revmischa
revmischa

(feat): deploy and test for new contracts

Closes #72

revmischa
revmischa

isn't date like day of the month? does this really work?

Apr
27
3 weeks ago
Activity icon
issue

revmischa issue comment Developer-DAO/web3-ui

revmischa
revmischa

`yarn release` is failing bc of missing Rollup CSS plugin

Output when running yarn release on the next branch:

❯ nr release
yarn run v1.22.18
$ yarn build && changeset publish
$ preconstruct build
🎁 info building bundles!
🎁 error @web3-ui/components Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
🎁 error @web3-ui/components     at error (/Users/dhaiwat/code/web3-ui/node_modules/rollup/dist/shared/rollup.js:158:30)
🎁 error @web3-ui/components     at Module.error (/Users/dhaiwat/code/web3-ui/node_modules/rollup/dist/shared/rollup.js:12382:16)
🎁 error @web3-ui/components     at Module.tryParse (/Users/dhaiwat/code/web3-ui/node_modules/rollup/dist/shared/rollup.js:12785:25)
🎁 error @web3-ui/components     at Module.setSource (/Users/dhaiwat/code/web3-ui/node_modules/rollup/dist/shared/rollup.js:12688:24)
🎁 error @web3-ui/components     at ModuleLoader.addModuleSource (/Users/dhaiwat/code/web3-ui/node_modules/rollup/dist/shared/rollup.js:22161:20) {
🎁 error @web3-ui/components   code: 'PARSE_ERROR',
🎁 error @web3-ui/components   parserError: SyntaxError: Unexpected token (1:0)
🎁 error @web3-ui/components       at Parser.pp$5.raise (/Users/dhaiwat/code/web3-ui/node_modules/rollup/dist/shared/rollup.js:19547:13)
🎁 error @web3-ui/components       at Parser.pp.unexpected (/Users/dhaiwat/code/web3-ui/node_modules/rollup/dist/shared/rollup.js:16872:8)
🎁 error @web3-ui/components       at Parser.pp$4.parseExprAtom (/Users/dhaiwat/code/web3-ui/node_modules/rollup/dist/shared/rollup.js:18922:10)
🎁 error @web3-ui/components       at Parser.pp$4.parseExprSubscripts (/Users/dhaiwat/code/web3-ui/node_modules/rollup/dist/shared/rollup.js:18714:19)
🎁 error @web3-ui/components       at Parser.pp$4.parseMaybeUnary (/Users/dhaiwat/code/web3-ui/node_modules/rollup/dist/shared/rollup.js:18680:17)
🎁 error @web3-ui/components       at Parser.pp$4.parseExprOps (/Users/dhaiwat/code/web3-ui/node_modules/rollup/dist/shared/rollup.js:18613:19)
🎁 error @web3-ui/components       at Parser.pp$4.parseMaybeConditional (/Users/dhaiwat/code/web3-ui/node_modules/rollup/dist/shared/rollup.js:18596:19)
🎁 error @web3-ui/components       at Parser.pp$4.parseMaybeAssign (/Users/dhaiwat/code/web3-ui/node_modules/rollup/dist/shared/rollup.js:18564:19)
🎁 error @web3-ui/components       at Parser.pp$4.parseExpression (/Users/dhaiwat/code/web3-ui/node_modules/rollup/dist/shared/rollup.js:18528:19)
🎁 error @web3-ui/components       at Parser.pp$1.parseStatement (/Users/dhaiwat/code/web3-ui/node_modules/rollup/dist/shared/rollup.js:17062:45) {
🎁 error @web3-ui/components     pos: 0,
🎁 error @web3-ui/components     loc: Position { line: 1, column: 0 },
🎁 error @web3-ui/components     raisedAt: 1
🎁 error @web3-ui/components   },
🎁 error @web3-ui/components   id: '/Users/dhaiwat/code/web3-ui/packages/components/src/components/Address/Address.css',
🎁 error @web3-ui/components   pos: 0,
🎁 error @web3-ui/components   loc: {
🎁 error @web3-ui/components     column: 0,
🎁 error @web3-ui/components     file: '/Users/dhaiwat/code/web3-ui/packages/components/src/components/Address/Address.css',
🎁 error @web3-ui/components     line: 1
🎁 error @web3-ui/components   },
🎁 error @web3-ui/components   frame: '1: .Web3UI_Address__Container {\n' +
🎁 error @web3-ui/components     '   ^\n' +
🎁 error @web3-ui/components     '2:   display: flex;\n' +
🎁 error @web3-ui/components     '3:   align-items: center;',
🎁 error @web3-ui/components   watchFiles: [
🎁 error @web3-ui/components     '/Users/dhaiwat/code/web3-ui/packages/components/src/index.ts',
🎁 error @web3-ui/components     '/Users/dhaiwat/code/web3-ui/packages/components/src/components/index.ts',
🎁 error @web3-ui/components     '/Users/dhaiwat/code/web3-ui/packages/components/src/components/AddressInput/index.ts',
🎁 error @web3-ui/components     '/Users/dhaiwat/code/web3-ui/packages/components/src/components/Address/index.ts',
🎁 error @web3-ui/components     '/Users/dhaiwat/code/web3-ui/packages/components/src/components/EtherInput/index.ts',
🎁 error @web3-ui/components     '/Users/dhaiwat/code/web3-ui/packages/components/src/components/Provider/index.ts',
🎁 error @web3-ui/components     '/Users/dhaiwat/code/web3-ui/packages/components/src/components/TokenBalance/index.ts',
🎁 error @web3-ui/components     '/Users/dhaiwat/code/web3-ui/packages/components/src/components/NFTGallery/index.ts',
🎁 error @web3-ui/components     '/Users/dhaiwat/code/web3-ui/packages/components/src/components/NFT/index.ts',
🎁 error @web3-ui/components     '/Users/dhaiwat/code/web3-ui/packages/components/src/components/MultiAddressInput/index.ts',
🎁 error @web3-ui/components     '/Users/dhaiwat/code/web3-ui/packages/components/src/components/Address/Address.tsx',
🎁 error @web3-ui/components     '/Users/dhaiwat/code/web3-ui/packages/components/src/components/EtherInput/EtherInput.tsx',
🎁 error @web3-ui/components     '/Users/dhaiwat/code/web3-ui/packages/components/src/components/NFTGallery/NFTGallery.tsx',
🎁 error @web3-ui/components     '/Users/dhaiwat/code/web3-ui/packages/components/src/components/AddressInput/AddressInput.tsx',
🎁 error @web3-ui/components     '/Users/dhaiwat/code/web3-ui/packages/components/src/components/Provider/Provider.tsx',
🎁 error @web3-ui/components     '/Users/dhaiwat/code/web3-ui/packages/components/src/components/TokenBalance/TokenBalance.tsx',
🎁 error @web3-ui/components     '/Users/dhaiwat/code/web3-ui/packages/components/src/components/NFT/NFT.tsx',
🎁 error @web3-ui/components     '/Users/dhaiwat/code/web3-ui/packages/components/src/components/MultiAddressInput/MultiAddressInput.tsx',
🎁 error @web3-ui/components     '/Users/dhaiwat/code/web3-ui/packages/components/src/components/Address/Address.css'
🎁 error @web3-ui/components   ]
🎁 error @web3-ui/components }
🎁 info If want to learn more about the above error, check https://preconstruct.tools/errors
🎁 info If the error is not there and you want to learn more about it, open an issue at https://github.com/preconstruct/preconstruct/issues/new
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

We're missing a Rollup CSS plugin.

revmischa
revmischa

Does preconstruct even support CSS? I found this issue: https://github.com/preconstruct/preconstruct/issues/417

I can't find any mention of custom rollup config in the docs https://preconstruct.tools/configuration

Apr
26
3 weeks ago
Apr
22
3 weeks ago
Activity icon
issue

revmischa issue comment aws-amplify/amplify-js

revmischa
revmischa

cognito.user.signOut() does not invalidate tokens

Describe the bug On calling state.cognito.user.signOut(), session tokens are just removed localstorage. The actual access tokens and refresh tokens are still valid for the lifecycle of the token.

Expected behavior This is a security issue. Best practice dictates session tokens should be invalidated server side on a logout request not just deleted on the client. (OWASP session management)

Source Code found here https://github.com/aws-amplify/amplify-js/blob/68a5ad2fe2b1d9f03cce80d1bf449e454b621760/packages/aws-amplify-react/src/Auth/SignOut.jsx

revmischa
revmischa

why don't you use different app clients, for mobile and web separately ? that's why there are app clients, no?

Because from a user experience point of view it's super lame to ask a user to sign in twice in the same browser, once to your extension and once to your website (in my case)

Apr
20
4 weeks ago
Activity icon
issue

revmischa issue comment prisma/prisma

revmischa
revmischa

Transaction SAVEPOINT support

Problem

I would like to use the SQL SAVEPOINT (nested transaction) feature for nesting transactions.

My use case: running integration tests inside of isolated transactions. More details in https://github.com/prisma/prisma/issues/9710

I would like to temporarily replace BEGIN statements with SAVEPOINT statements for code executed in my test. The idea is that I want to wrap each test inside its own transaction so it's isolated and doesn't see data from any other tests running at the same time, and issue a ROLLBACK at the end so the test never actually commits anything to the DB.

To make this work I need to disable any code running inside the test from beginning a new transaction, instead creating a savepoint. More details can be seen in #9710.

Suggested solution

Something like SQLAlchemy perhaps: https://docs.sqlalchemy.org/en/14/orm/session_transaction.html#using-savepoint

Alternatives

Currently I have to run integration tests one by one and truncate every table at the end of each test. This is horribly slow and inefficient and prevents me from running my tests in parallel.

Additional context

https://github.com/prisma/prisma/issues/9710

revmischa
revmischa

This feels a lot like #12458 would using that extension help you?

Getting a handle to the transaction in beforeEach and rolling back in afterEach would be needed, but it doesn't help with nested transactions or overriding BEGIN while inside the test.

Activity icon
issue

revmischa issue prisma/prisma

revmischa
revmischa

Transaction SAVEPOINT support

Problem

I would like to use the SQL SAVEPOINT (nested transaction) feature for nesting transactions.

My use case: running integration tests inside of isolated transactions. More details in https://github.com/prisma/prisma/issues/9710

I would like to temporarily replace BEGIN statements with SAVEPOINT statements for code executed in my test. The idea is that I want to wrap each test inside its own transaction so it's isolated and doesn't see data from any other tests running at the same time, and issue a ROLLBACK at the end so the test never actually commits anything to the DB.

To make this work I need to disable any code running inside the test from beginning a new transaction, instead creating a savepoint. More details can be seen in #9710.

Suggested solution

Something like SQLAlchemy perhaps: https://docs.sqlalchemy.org/en/14/orm/session_transaction.html#using-savepoint

Alternatives

Currently I have to run integration tests one by one and truncate every table at the end of each test. This is horribly slow and inefficient and prevents me from running my tests in parallel.

Additional context

https://github.com/prisma/prisma/issues/9710

Previous