Open 2blo opened 1 year ago
npm run start
npm run cypress -- --e2e
from the twitter thread: use if checks on path, and a global matcher https://nextjs.org/docs/advanced-features/middleware#conditional-statements
can prevent nav to edit page with nextauth middleware, but it seems to show a blank loading state for a while on every nav.
access to delete post is gated by userid
== session.user.id
beforeeffects.help@gmail.com
User
in the dbif we hardcode post.upload with the users id, it works, still cant delete tho:
There is no post with id 'cleotq99h000jwnzk5hjvfgov' created by user 'cleotqlpp000wzkwn7uyf7x3g'.
110,cleotq99h000jwnzk5hjvfgov,VIDEO,asd,asd,UfUbBWIFdJs,UfUbBWIFdJs,cleotl6od000tzkwnf2253cmn,2023-02-28 22:32:00.870
data: inferPostFormatting(input, "cleotl6od000tzkwnf2253cmn"),
the backend context is not the same as the frontend context... thats why we get undefined user constraint, the backend user is different
id we hardcode the id, instead of cuid
create + delete works... just need to find out how to sync them..
"When you write Cypress tests for Next.js apps, you can’t mock requests coming from SSR. You can only mock requests coming from the browser via cy.intercept()." https://blog.byndyusoft.com/testing-next-js-website-with-cypress-a8475fd087e2
plan, borrowed from https://dev.to/kuroski/writing-integration-tests-for-nextjs-next-auth-prisma-using-playwright-and-msw-388m
sessionToken
sessionToken
npx run docker:up
npx run test:db:push
npx run e2e:login
sessionToken
tRPC failed on post.upload: TRPCError: UNAUTHORIZED
sessionToken
correctnessVerificationToken
tablehttps://nextjs.org/docs/advanced-features/ci-build-caching#github-actions cache .npm, + .next/cache, not node_modules, it has some compiled packages, and is not used by npm ci
missing if cache hit
https://dev.to/drakulavich/aggressive-dependency-caching-in-github-actions-3c64
also, can we make cache different for .next
and .npm
setup node has built in cache https://github.com/actions/setup-node#caching-global-packages-data
there is no native npm build, it just runs next build "build": "next build",
pages that should not be accessible
we dont care too much about ux, users will just see this page if they try to mess up, dont care about middleware for now.
CI issues
reuse
other
npm run build
, so we are still trying to use redis. Do not care for now, but if it becomes a problem we can enable or disable redis with a run argument.