This is a template you can use to report issues. You can also drag images, videos and include Preformatted text
Expected behavior
When I click on a smart action, I expected this one to run “or at least trigger the backend endpoint”
Actual behavior
I keep on getting HttpError: HTTP Error 500: Internal Server Error
:
I don’t even reach my backend code… it’s really weird. All my actions are failing…
.forestadmin-schema.json
"actions": [
{
"name": "My Action",
"type": "global",
"baseUrl": null,
"endpoint": "/forest/actions/my-collection/my-action",
"httpMethod": "POST",
"redirect": null,
"download": false,
"fields": [],
"hooks": {
"load": false,
"change": []
}
}]
routes/my-collection.ts
// Runs a certain smart action
router.post('/actions/my-collection/my-action', permissionMiddlewareCreator.smartAction(), (request, response) => {
// Learn what this route does here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/routes/default-routes#delete-a-list-of-records
console.log("hello")
next();
});
forest/my-collection.ts
actions: [{
name: 'My Action',
endpoint: '/forest/actions/my-collection/my-action',
httpMethod: 'POST',
type: 'global'
}]
Failure Logs
I don’t have logs within IntelliJ, but i got some in the google chrome console:
chunk.7.3063f605868b6fe645c9.js:353 POST http://localhost:3310/forest/actions/my-collection/my-action?timezone=Europe%2FParis 500 (Internal Server Error)
(anonymous) @ chunk.7.3063f605868b6fe645c9.js:353
(anonymous) @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:21590
l @ appcues.main.83fbeef7bf4ee67f632f0e183fb2ecbd97bb7539.js:1
(anonymous) @ appcues.main.83fbeef7bf4ee67f632f0e183fb2ecbd97bb7539.js:1
(anonymous) @ appcues.main.83fbeef7bf4ee67f632f0e183fb2ecbd97bb7539.js:1
d @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:21569
a @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:21598
Promise.then (async)
d @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:21569
a @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:21598
(anonymous) @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:21598
(anonymous) @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:21597
(anonymous) @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:21599
t @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:21586
(anonymous) @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:22430
l @ appcues.main.83fbeef7bf4ee67f632f0e183fb2ecbd97bb7539.js:1
(anonymous) @ appcues.main.83fbeef7bf4ee67f632f0e183fb2ecbd97bb7539.js:1
(anonymous) @ appcues.main.83fbeef7bf4ee67f632f0e183fb2ecbd97bb7539.js:1
u @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:22409
a @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:22411
Promise.then (async)
u @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:22409
a @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:22411
(anonymous) @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:22411
(anonymous) @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:22410
(anonymous) @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:22431
(anonymous) @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:22037
l @ appcues.main.83fbeef7bf4ee67f632f0e183fb2ecbd97bb7539.js:1
(anonymous) @ appcues.main.83fbeef7bf4ee67f632f0e183fb2ecbd97bb7539.js:1
(anonymous) @ appcues.main.83fbeef7bf4ee67f632f0e183fb2ecbd97bb7539.js:1
O @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:22007
a @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:22009
(anonymous) @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:22009
(anonymous) @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:22008
(anonymous) @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:22038
(anonymous) @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:22083
Promise.then (async)
value @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:22083
value @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:22073
triggerCustomAction @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:1779
A @ vendor-5274ce00880a892114c98442cc88aca6.js:3143
c.triggerEvent @ vendor-5274ce00880a892114c98442cc88aca6.js:3073
n.trigger @ vendor-5274ce00880a892114c98442cc88aca6.js:5740
s.send @ vendor-5274ce00880a892114c98442cc88aca6.js:3099
send @ vendor-5274ce00880a892114c98442cc88aca6.js:3254
value @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:19174
value @ client-eb071c47afc283a9269e0b7ef1f0b9b3.js:6616
(anonymous) @ vendor-5274ce00880a892114c98442cc88aca6.js:2259
r @ chunk.7.3063f605868b6fe645c9.js:318
chunk.7.3063f605868b6fe645c9.js:325 HttpError: HTTP Error 500: Internal Server Error
at client-eb071c47afc283a9269e0b7ef1f0b9b3.js:23829
at l (appcues.main.83fbeef7bf4ee67f632f0e183fb2ecbd97bb7539.js:1)
at Generator._invoke (appcues.main.83fbeef7bf4ee67f632f0e183fb2ecbd97bb7539.js:1)
at Generator.next (appcues.main.83fbeef7bf4ee67f632f0e183fb2ecbd97bb7539.js:1)
at n (client-eb071c47afc283a9269e0b7ef1f0b9b3.js:23772)
at l (client-eb071c47afc283a9269e0b7ef1f0b9b3.js:23774)
Context
Here is my package json file
{
"name": "my-backoffice",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node ./dist/server.js",
"build": "rm -rf ./dist && npm run compile",
"dev": "tsc-watch --onSuccess \"node ./dist/server.js\"",
"compile": "tsc",
"lint": "eslint . -c .eslintrc.json --ext .ts"
},
"dependencies": {
"@google-cloud/pubsub": "^2.17.0",
"@types/express": "^4.17.13",
"@types/mongoose": "^5.11.97",
"@types/node": "^16.3.3",
"axios": "^0.21.1",
"body-parser": "^1.19.0",
"chalk": "~1.1.3",
"cookie-parser": "1.4.4",
"cors": "2.8.5",
"debug": "~4.0.1",
"dotenv": "~6.1.0",
"express": "~4.17.1",
"express-jwt": "6.0.0",
"forest-express-mongoose": "^8.0.0",
"mongoose": "~5.8.2",
"morgan": "1.9.1",
"nodemon": "^2.0.12",
"require-all": "^3.0.0",
"ts-node": "^10.1.0",
"tsc-watch": "^4.4.0",
"typescript": "^4.3.5"
}
}
Extra note
I was developing some other parts since I upgraded my project to the latest version (and fully translated it into typescript) so I just reintegrated the smart actions and yes… I don’t know why but it’s not working at all
Thanks for any help!
Max