vercel toolbar failing during build
Answered
Asiatic Lion posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Asiatic LionOP
Hello!
We followed the docs for the toolbar but encountering issues during build. Everything appears to work as expected during development.
Please see the PR: https://github.com/bautistaaa/typehero/pull/412
Build Log Errors(image attached)
We followed the docs for the toolbar but encountering issues during build. Everything appears to work as expected during development.
Please see the PR: https://github.com/bautistaaa/typehero/pull/412
Build Log Errors(image attached)
![Image](https://cdn.discordapp.com/attachments/1145009379054207006/1145009379511382116/CleanShot_2023-08-26_at_07.58.042x.png)
54 Replies
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Asiatic LionOP
cc @Dutch
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Dutch
i think the issue is the missing import for the ESM folk
![Image](https://cdn.discordapp.com/attachments/1145009379054207006/1145011528177815734/image.png)
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/f386ac21405ce3442e0f3598223e1cb3.webp?size=256)
joulev
can't help with anything here, but wow what is this
@vercel/toolbar
first time i heard of it
there is zero documentation except on npmjs.com/@vercel/toolbar too
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Dutch
yeah it's rather SEKRIT methinks
but it allows you to add the comments toolbar to locahost and even non-next apps
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/f386ac21405ce3442e0f3598223e1cb3.webp?size=256)
joulev
not entirely sure what's wrong, i tried it and it works well, [code](https://github.com/joulev/debug/tree/try-this-secret-vercel-toolbar-thing) and [deployment log](https://vercel.com/joulev/debug/3F9WHdHMQNYYLzYqASCvTkQTssSu)
and locally the toolbar does show up normally
so probably something buggy is between this simple minimal code and your PR; could you divide and conquer the code to get a more minimal setup that doesn't work?
also, maybe try
next.config.mjs
and use modular syntax instead of next.config.js
, i had similar issues with unrelated libraries before![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Dutch
try converting to module/mjs and see if it borks if you ahve time?
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/f386ac21405ce3442e0f3598223e1cb3.webp?size=256)
joulev
hmm so this errors
// @ts-check
import withVercelToolbar from "@vercel/toolbar/plugins/next";
const nextConfig = {};
export default withVercelToolbar()(nextConfig);
wait
in my code above i didn't have
ts-check
maybe it's just a ts error and the type is just wrong
yeah with
ts-check
then this code fails toothe type is just wrong, just put
ts-expect-error
thereit seems
withVercelToolbar
should be exported as default here, not as a named export![Image](https://cdn.discordapp.com/attachments/1145009379054207006/1145022785777844324/image.png)
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Dutch
you shouldnt be having to battle with TS in an ESM file though ![:Thonk:](https://cdn.discordapp.com/emojis/1002479416468832286.png)
![:Thonk:](https://cdn.discordapp.com/emojis/1002479416468832286.png)
but maybe cause of the the type defs i guess
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/f386ac21405ce3442e0f3598223e1cb3.webp?size=256)
joulev
yeah the type definition is wrong
just slap the
ts-expect-error
and everything will work fine![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Dutch
yes that's the problem too why I had:
import { default as withVercelToolbar } from '@vercel/toolbar/plugins/next';
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/f386ac21405ce3442e0f3598223e1cb3.webp?size=256)
joulev
wait, what file is this
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Dutch
so the exports are borked on their end, I could patch package it to see if it's a way to unblock
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/f386ac21405ce3442e0f3598223e1cb3.webp?size=256)
joulev
yeah then i think patching
@vercel/toolbar/dist/plugins/next.d.ts
is goodjust export
withVercelToolbar
as default instead![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Dutch
i wish I could just raise a PR
who from the god team can we tag here to help us make the better option 😬
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/f386ac21405ce3442e0f3598223e1cb3.webp?size=256)
joulev
yeah can confirm patching + moving to mjs works
Answer
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/f386ac21405ce3442e0f3598223e1cb3.webp?size=256)
joulev
this works fine in next dev, can build and typescript is happy with the next.config file too
i don't know either, i'm also just a normal user like you, but there is a secret channel here with vercel staff in there, i'll forward this bug to them there
forwarded this to them, but that secret channel hasn't had a message for 2 months so we can only hope someone will care enough to come lol
in the meantime we just need to apply the patch
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Dutch
i dont think it works for our mono repo setup 😦
![:eyes_sus:](https://cdn.discordapp.com/emojis/1144756336937140304.png)
![Image](https://cdn.discordapp.com/attachments/1145009379054207006/1145027947632263258/image.png)
still grinding let me see
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/f386ac21405ce3442e0f3598223e1cb3.webp?size=256)
joulev
it would be scary if it was a runtime error, but this is just a typescript error so i think the patch should be sufficient ![:thinkies:](https://cdn.discordapp.com/emojis/735597282182824037.png)
![:thinkies:](https://cdn.discordapp.com/emojis/735597282182824037.png)
if it doesn't work feel free to post the error here i will try tomorrow
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Dutch
yeah will share the commit
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/f386ac21405ce3442e0f3598223e1cb3.webp?size=256)
joulev
it's already late here so bedtime
yeah no worries @joulev thanks for the halp
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/f386ac21405ce3442e0f3598223e1cb3.webp?size=256)
joulev
https://github.com/joulev/debug/commit/338a11a2a57b6f34bfee6426a6091a13fb432d89
hmm it works fine for me
hmm it works fine for me
what was the error in your case?
can you simplify the repo to a minimal reproduction? because at the current state there are lots of things to set up so i can't just clone it and try to deploy myself
@Dutch ping
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Dutch
Yeah typehero has a bunch of setup, I can try again tomorrow
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Dutch
its working now ![:eyes_sus:](https://cdn.discordapp.com/emojis/1144756336937140304.png)
![:eyes_sus:](https://cdn.discordapp.com/emojis/1144756336937140304.png)
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Dutch
@Asiatic Lion mark as resolved please
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Asiatic LionOP
at the store where’s the resolve button, can i just put a green check mark