I am trying to deploy in production my app. It works fine on local environment but not in production
Expected behavior
I’ve created a smart field representing a pre signed url from AWS S3. Here’s the configuration :
collection(‘users’, {
actions: ,
fields: [{
field: “DOC ID”,
type: ‘String’,
get: async user => {
if (user?.identityDocuments[0]?.name) {
return await generatePreSignedUrlS3ForGet(user.identityDocuments[0].name, 300) //function used to generate a presigned URL from S3
} else {
return ‘-’
}
}
}],
segments: ,
});
This code works fine on local environment
Actual behavior
I’ve deployed the app on an Heroku instance. I have a log saying : “An error occured while computing the Forest schema. Your application schema cannot be synchronized with Forest. Your admin panel might not reflect your application models definition. Unexpected token ‘.’”
The ‘.’ points towards ‘user?.’ and I don’t understand why it is an unexpected token.
Hello Guillaume, thanks for your prompt answer!
What would you need in the stack trace ? I don’t think it really comes from the user?. but that’s the message I get from the Heroku instance :
Thank you it worked, you’ve made my day! Just for my understanding, I don’t see any babel dependencies installed on my local environement, do you know where it could be from?
I think there is something different between your local and production environment.
But that would require introspection with the architecture code under my eyes.
Definitively it looks like a configuration issue, try to look how is deployed your project
The optional chaining support was introduced in node v14 so in order to use it without any additional babel configuration you need to have at least this version.
Most probably you have different node versions installed on local (at least v14) and remote (probably v12) environments.
I am not sure about Heroku’s default behavior if the engine version is not specified, but you should be able to check both versions by doing node -v
If indeed Heroku is using v12 as the default one, you can try to enforce the v14 by adding
"engines": {
"node": "14.15.4"
},
in the package.json file of your project.
Let me know if this helps or if you have any more questions