👋 got my project working locally with
👋 got my project working locally with convex (nextjs 13 project) but my build/deployment fails on vercel.
well, i should say it hangs. i followed the docs and have my env variables yet and custom build command to include
npx convex deploy
27 Replies
it gets this far and has been running for about 10 min 😦
eee. Just as a sanity check - does the
npx convex deploy
command work if you run it locally? Also npm run build
?yes and yes
actually that's not true sorry
Good stuff getting everything working together btw! Let's figure out how to get it deployed for the last step
i think i might need tro make a change to my tsconfig for next
let me pull in my bud @ballingt - I think he might have context here.
my favorite guy
me too
tom makes the world go round
yeah i think that's the problem
"exclude": ["node_modules", "convex"]
forgot to add this i think
damn nevermind i have that here tooSo someone else ran into this problem yesterday https://discord.com/channels/1019350475847499849/1019350478817079338/1078127155306827828 - which may or may not be relevant. Where we were seeing some issue with typescript not finding
schema.ts
but only when using next
But the symptoms are subtly different, so I'm not 100% sure
Check if baseUrl
is in your typescript template and if the "fix" that they talked about in that thread helps.huh interesting; changing the
convex/
directory to anything but convex?
i do indeed have: "baseUrl": ".",
My understanding is that
"baseUrl": "."
causes TypeScript to resolve imports for convex/schema
as a path relative to your project instead of the Convex npm package (so it can't find defineSchema
because presumably you're not defining that in your own convex/schema.ts
file).okay renaming things also fixed my issue
So naming your
convex
directory to convex-foo
or basically anything else should mean that the convex/schema
import in your convex-foo/schema.ts
file resolves to our npm package 🤞did something change recently in a new version of TS or something? this was working a couple weeks ago but did just update npm packages
at least
npm run build
works; seeing if my deployment goes any further
deployment still hangs at "Detected Next.js project."
going to take a break; spent an hour trying to compare differences between a working deployment and thisOur friend Tom filed this against Next https://github.com/vercel/next.js/issues/46288 - and has a hypothesis that it might be a january regression
GitHub
baseUrl in create-next-app causes local files to shadow npm package...
Verify canary release I verified that the issue exists in the latest Next.js canary release Provide environment information tomb@Thomass-MacBook-Pro-2 abcef % npx --no-install next info Operating S...
OK the "Detected Next.js project." might be trying to prompt to offer to save an environment variable
We should at least detect CI and not offer in those cases
could i temporarily put in the convex url variable?
to skip the prompt?
@void yeah!
There's a flag
--no-save-url
I want to see if this is also what @andresBeltran is hitting when they're back onlineso i'd have to probably use the flag in the build command and add the URL in environment variables right? not one or the other?
We need to change it to be one or the other
but yes right now it just checks
.env
for NEXT_PUBLIC_CONVEX_URL or whatever
and not the actual environmenthmm okay tried deploying after just setting
NEXT_PUBLIC_CONVEX_URL
in all envs in vercel dashboard; redeployed and still got same error
changed build command to include --no-save-url
and redeployed then got this far:ill keep diggin 🤓
idk if it matters but it looks like it's always deploying to prod convex even tho im in a vercel preview env dev branch
that is interesting (and we should change that!)
ok "unable to build indexes" is interesting
This has been fixed in Next.js! https://github.com/vercel/next.js/pull/46458
If you started a project with a Next.js template between Jan 6 2023 and whenever the next Next.js release is you'll still see this issue, you can make the change manually by deleting
baseUrl: "."
from the tsconfig.json
.
As seen above, another workaround is to change the name of the convex/
directory by moving it changing the corresponding line in convex.json
.GitHub
Remove baseUrl from create-next-app ts/jsconfig.json by thomasballi...
Fixes #46288
Makes TypeScript behavior match runtime by no longer allowing files to be imported absolutely relative to project root without using a relative path or a path alias. This changes behav...
sweet thanks updated next and renamed back to
convex/
, removed baseUrl
and we're golden 🙂