Comments (16)
It is working correctly - Base type collections must have at least one schema field. There should be also an error tooltip next to the "Fields" tab:
from pocketbase.
Thank you for the quick reply and explanation!!!
However, I do not see that error tooltip?! Not in Firefox (my default) and not in Safari?
Also: the UI hangs if I get the error that I described. Ideally pb could test if there is only one field left and prevent the error (and hanging) from happening ;)
from pocketbase.
Again, it works correctly for me. Just tested it with Firefox 124:
Also: the UI hangs
It doesn't hang for me. Or at least specify what do you mean by this.
from pocketbase.
If by "hangs" you mean the disabled state of the field - this is just the style we use to show that the current field is marked for deletion. You can click on the yellow Restore
button to revert the operation.
from pocketbase.
Very strange...
By hanging I mean I can move the cursor and click anywhere, but there is no response. For example I cannot close the green message at the bottom and I cannot close the right side window. Also notice the 'save' button bottom right shows a spinning wheel instead. Plus I do not see the red tooltip - should that be at this moment?
I checked again, this is Firefox 124.0.
The only way to get out of this page is by reloading.
from pocketbase.
I'm not able to reproduce it.
You could check if there is a JS error message in the browser console. It is possible to be caused also by a browser plugin, I'm not sure.
from pocketbase.
Additionally, if you have custom Go or JS hooks try to temporary disable them.
from pocketbase.
Good idea to check the js console.
The moment that I click to go ahead and really remove the (one) field, this error pops up:
17:12:21.526 Uncaught (in promise) TypeError: L.name is undefined
s http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
update http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
T0 http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
aa http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
promise callback*Ng http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
D0 http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
ctx http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
U7 http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:157
l http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
s http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
wa http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:13
R http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
promise callback*R http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
de http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
lt http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
lt http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
_ http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
y http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
J http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:7
m http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
m http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:42
p http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:42
T0 http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
aa http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
promise callback*Ng http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
D0 http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
ctx http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
C http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:42
m http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
L http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
G http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
J http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:7
m http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
m http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:42
p http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:42
T0 http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
aa http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
promise callback*Ng http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
D0 http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
ctx http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
x5 http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
l http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
Zt http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:13
I http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
C http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
N http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:116
aa http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
(Async: promise callback)
Ng http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
D0 http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
ctx http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
U7 http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:157
l http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
s http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
wa http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:13
R http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
(Async: promise callback)
R http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
de http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
lt http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
forEach self-hosted:203
lt http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
_ http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
y http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
(Async: EventListener.handleEvent)
J http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:7
m http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
m http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:42
p http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:42
T0 http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
aa http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
(Async: promise callback)
Ng http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
D0 http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
ctx http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
C http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:42
m http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
InterpretGeneratorResume self-hosted:1465
AsyncFunctionNext self-hosted:852
(Async: async)
L http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
G http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
(Async: EventListener.handleEvent)
J http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:7
m http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
m http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:42
p http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:42
T0 http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
aa http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
(Async: promise callback)
Ng http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
D0 http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
ctx http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
x5 http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
l http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:10
Zt http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:13
I http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
C http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:92
N http://127.0.0.1:8090/_/assets/index-DNY9pI36.js:116
from pocketbase.
And something else: I have some Go hooks. I just now disabled all of them and indeed then everything works! So it is something with the hooks. I have to check which one.
from pocketbase.
Found the problem. I added this hook and it seems to block something. I added this to show user friendly errors instead of a json:
// show friendly page on errors
app.OnBeforeApiError().Add(func(e *core.ApiErrorEvent) error {
tmpl, err := template.ParseFS(app.fs, "error.html")
if err != nil {
return hook.StopPropagation
}
buf := &bytes.Buffer{}
err = tmpl.Execute(buf, map[string]interface{}{"message": e.Error})
if err != nil {
return hook.StopPropagation
}
return e.HttpContext.HTML(http.StatusOK, buf.String())
})
from pocketbase.
Is there a way to detect if the user is currently in the admin UI? So I can skip this handling in that case.
from pocketbase.
You can retrieve the auth context from the e.HttpContext
(usually named c
in the routing examples), something like:
// see also https://pocketbase.io/docs/go-routing/#retrieving-the-current-auth-state
admin, _ := e.HttpContext.Get(apis.ContextAdminKey).(*models.Admin)
if admin != nil {
return nil
}
But in general I'd recommend to not change globally all API errors as this could also break the SDKs because they work only with JSON responses.
from pocketbase.
I also forgot to mention that the above doesn't guarantee that the request is sent from the Admin UI (we currently don't have such marker, but I'll consider it with the refactoring), only that it is performed by an authenticated admin.
from pocketbase.
Yes I know how to determine a user or admin. Would indeed be nice to know the user/admin is currently in the admin UI.
But in general I'd recommend to not change globally all API errors as this could also break the SDKs because they work only with JSON responses.
It seemed the only way to show friendly errors to a user? For example to show a friendly 'page not found'. Is there another way? FYI: I use pb as a framework and do not use any frontend js solutions.
from pocketbase.
If you are not using the builtin web APIs, one workaround could be to skip the error handler for all regular /api/*
paths:
if strings.HasPrefix(e.HttpContext.Path(), "/api/") {
return nil // api path
}
...
from pocketbase.
I use the web APIs a lot 😅
But I found this workaround:
if strings.HasSuffix(e.HttpContext.Request().Referer(), "/_/") {
return nil // user is in admin UI
}
from pocketbase.
Related Issues (20)
- Uploading ".doc" file not allowed HOT 3
- Proposal: Add Cache-Control header during file creation
- Realtime/sub JSON field issue ? v0.22.11
- facing CORS error when hosting via docker but not with the binary on host system
- Date picker in admin UI shows wrong dates/days HOT 1
- Accent-insensitive when using getList (filter) HOT 1
- Expand single attribute not working HOT 1
- S3 Compatible Storage from Linode HOT 1
- Admin UI Firefox performance issue HOT 1
- CRUD requests blocked by hooks return 200 HOT 2
- Presentable columns are not referenced, when nested inside another relation HOT 1
- Nextjs 14 Pocketbase Authentication
- pb.authStore.loadFromCookie not working HOT 1
- @collection.* API Filter doesnt work
- Bug: Creating a user from Admin UI crashes pocketbase HOT 3
- Feature Request: For the relation fields in Admin UI, add a "Open Record In New Tab" button HOT 1
- Change: No body uses bytes, please add a dropdown option to select, between bytes, mb, gb, tb, yb HOT 1
- Can't connect Minio S3 instance HOT 2
- Feature Request: More/Custom Variables | Customize E-Mail Confirm Screen HOT 1
- GoogleAuth.URL is empty? HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pocketbase.